- Supports 'urgency.uda.<name>.<value>.coefficient' (TW-1354)
This commit is contained in:
Johannes Schlatow 2014-10-10 14:45:03 +02:00 committed by Paul Beckingham
parent 53fd37cae2
commit a88a062d3d
3 changed files with 22 additions and 3 deletions

View file

@ -139,6 +139,7 @@
- TW-1341 confirmation config setting should apply to config command as well - TW-1341 confirmation config setting should apply to config command as well
(thanks to Charles Ulrich). (thanks to Charles Ulrich).
- TW-1345 taskrc.5 manpage errors. - 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-1359 "one-two-three" in description triggers Malformed ID error.
- TW-1360 color.until directive missing. - TW-1360 color.until directive missing.
- TW-1361 Strange results with complex filter (thanks to Jim B). - TW-1361 Strange results with complex filter (thanks to Jim B).

View file

@ -1081,6 +1081,10 @@ Specific project coefficient.
.RS .RS
Presence/absence of UDA data. Presence/absence of UDA data.
.RE .RE
.B urgency.uda.<name>.<value>.coefficient=...
.RS
Specific value of UDA data.
.RE
The coefficients reflect the relative importance of the various terms in the 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 urgency calculation. These are default values, and may be modified to suit your

View file

@ -1683,12 +1683,26 @@ float Task::urgency_c () const
} }
else if (var->first.substr (0, 12) == "urgency.uda.") else if (var->first.substr (0, 12) == "urgency.uda.")
{ {
// urgency.uda.<name>.coefficient // urgency.uda.<name>.coefficient and urgency.uda.<name>.<value>.coefficient
std::string::size_type end = var->first.find (".coefficient"); std::string::size_type end = var->first.find (".coefficient");
if (end != std::string::npos) if (end != std::string::npos)
if (has (var->first.substr (12, end - 12))) {
const std::string uda = var->first.substr (12, end -12);
std::string::size_type dot = uda.find(".");
if (dot == std::string::npos)
{
// urgency.uda.<name>.coefficient
if (has (uda))
value += var->second; value += var->second;
} }
else
{
// urgency.uda.<name>.<value>.coefficient
if (get (uda.substr(0, dot)) == uda.substr(dot+1))
value += var->second;
}
}
}
} }
} }
#endif #endif