diff --git a/ChangeLog b/ChangeLog index eb1973750..8d8a2b621 100644 --- a/ChangeLog +++ b/ChangeLog @@ -139,6 +139,7 @@ - TW-1341 confirmation config setting should apply to config command as well (thanks to Charles Ulrich). - TW-1345 taskrc.5 manpage errors. +- TW-1354 Add value-dependent urgency coefficients for UDAs. - TW-1359 "one-two-three" in description triggers Malformed ID error. - TW-1360 color.until directive missing. - TW-1361 Strange results with complex filter (thanks to Jim B). diff --git a/doc/man/taskrc.5.in b/doc/man/taskrc.5.in index 80b508764..b5f192d0c 100644 --- a/doc/man/taskrc.5.in +++ b/doc/man/taskrc.5.in @@ -1081,6 +1081,10 @@ Specific project coefficient. .RS Presence/absence of UDA data. .RE +.B urgency.uda...coefficient=... +.RS +Specific value of UDA data. +.RE The coefficients reflect the relative importance of the various terms in the urgency calculation. These are default values, and may be modified to suit your diff --git a/src/Task.cpp b/src/Task.cpp index aabdccd4f..734f1c16c 100644 --- a/src/Task.cpp +++ b/src/Task.cpp @@ -1683,11 +1683,25 @@ float Task::urgency_c () const } else if (var->first.substr (0, 12) == "urgency.uda.") { - // urgency.uda..coefficient + // urgency.uda..coefficient and urgency.uda...coefficient std::string::size_type end = var->first.find (".coefficient"); if (end != std::string::npos) - if (has (var->first.substr (12, end - 12))) - value += var->second; + { + const std::string uda = var->first.substr (12, end -12); + std::string::size_type dot = uda.find("."); + if (dot == std::string::npos) + { + // urgency.uda..coefficient + if (has (uda)) + value += var->second; + } + else + { + // urgency.uda...coefficient + if (get (uda.substr(0, dot)) == uda.substr(dot+1)) + value += var->second; + } + } } } }