From e3dd91d45eb2865433396b54b3526695fd8a98fd Mon Sep 17 00:00:00 2001 From: "Dustin J. Mitchell" Date: Fri, 17 Dec 2021 01:45:53 +0000 Subject: [PATCH] use the existing (but misnamed) orphans method --- src/Task.cpp | 2 +- src/Task.h | 2 +- src/commands/CmdEdit.cpp | 2 +- src/commands/CmdUDAs.cpp | 8 ++------ 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/Task.cpp b/src/Task.cpp index f1a903181..434cd49b3 100644 --- a/src/Task.cpp +++ b/src/Task.cpp @@ -1559,7 +1559,7 @@ bool Task::isAnnotationAttr(const std::string& attr) #ifdef PRODUCT_TASKWARRIOR //////////////////////////////////////////////////////////////////////////////// // A UDA Orphan is an attribute that is not represented in context.columns. -std::vector Task::getUDAOrphanUUIDs () const +std::vector Task::getUDAOrphans () const { std::vector orphans; for (auto& it : data) diff --git a/src/Task.h b/src/Task.h index fcdf168ab..c48104a53 100644 --- a/src/Task.h +++ b/src/Task.h @@ -159,7 +159,7 @@ public: std::vector getBlockedTasks () const; std::vector getDependencyTasks () const; - std::vector getUDAOrphanUUIDs () const; + std::vector getUDAOrphans () const; void substitute (const std::string&, const std::string&, const std::string&); #endif diff --git a/src/commands/CmdEdit.cpp b/src/commands/CmdEdit.cpp index efd4cb619..5c83b0eba 100644 --- a/src/commands/CmdEdit.cpp +++ b/src/commands/CmdEdit.cpp @@ -324,7 +324,7 @@ std::string CmdEdit::formatTask (Task task, const std::string& dateformat) } // UDA orphans - auto orphans = task.getUDAOrphanUUIDs (); + auto orphans = task.getUDAOrphans (); if (orphans.size ()) { before << "# User Defined Attribute Orphans\n"; diff --git a/src/commands/CmdUDAs.cpp b/src/commands/CmdUDAs.cpp index 048c41e59..d10badcd9 100644 --- a/src/commands/CmdUDAs.cpp +++ b/src/commands/CmdUDAs.cpp @@ -134,12 +134,8 @@ int CmdUDAs::execute (std::string& output) std::map orphans; for (auto& i : filtered) { - for (auto& att : i.data_removeme ()) - if (! Task::isAnnotationAttr (att.first) && - ! Task::isTagAttr (att.first) && - ! Task::isDepAttr (att.first) && - Context::getContext ().columns.find (att.first) == Context::getContext ().columns.end ()) - orphans[att.first]++; + for (auto& att : i.getUDAOrphans ()) + orphans[att]++; } if (orphans.size ())