TW-1627: 'mon' is replaced with date in project field

- Thanks to James Cline.
This commit is contained in:
Paul Beckingham 2015-07-28 23:44:20 -04:00
parent 51cf195b99
commit 16cee8e263
3 changed files with 8 additions and 24 deletions

View file

@ -264,3 +264,4 @@ suggestions:
Florian Petry Florian Petry
Lars Beckers Lars Beckers
Dustin J. Mitchell Dustin J. Mitchell
James Cline

View file

@ -71,6 +71,7 @@
- TW-1622 Duration UDA can't take an algebraic expression (thanks to Jeremy John - TW-1622 Duration UDA can't take an algebraic expression (thanks to Jeremy John
Reeder). Reeder).
- TW-1626 Wrong wait date (thanks to Andrea Rizzi). - TW-1626 Wrong wait date (thanks to Andrea Rizzi).
- TW-1627 'mon' is replaced with date in project field (thanks to James Cline).
- TW-1632 Japanese translation for Taskwarrior(150713) (thanks to ribbon). - TW-1632 Japanese translation for Taskwarrior(150713) (thanks to ribbon).
- TW-1634 due.not:<date> excludes only tasks scheduled at mitnight (thanks to - TW-1634 due.not:<date> excludes only tasks scheduled at mitnight (thanks to
Tomas Babej). Tomas Babej).

View file

@ -2135,39 +2135,21 @@ void Task::modify (modType type, bool text_required /* = false */)
++modCount; ++modCount;
} }
// String type columns may eval, or may not make sense to eval, and // String type columns are not eval'd.
// the best way to determine this is to try.
else if (column->type () == "string") else if (column->type () == "string")
{ {
std::string evaluated = value; if (column->validate (value))
try
{
Eval e;
e.addSource (domSource);
e.addSource (namedDates);
contextTask = *this;
Variant v;
e.evaluateInfixExpression (value, v);
v.cast (Variant::type_string);
evaluated = v.get_string ();
}
catch (...) { /* NOP */ }
// Final default action
if (column->validate (evaluated))
{ {
if (column->can_modify ()) if (column->can_modify ())
{ {
std::string col_value = column->modify (evaluated); std::string col_value = column->modify (value);
context.debug (label + name + " <-- '" + col_value + "' <-- '" + evaluated + "' <-- '" + value + "'"); context.debug (label + name + " <-- '" + col_value + "' <-- '" + value + "'");
(*this).set (name, col_value); (*this).set (name, col_value);
} }
else else
{ {
context.debug (label + name + " <-- '" + evaluated + "' <-- '" + value + "'"); context.debug (label + name + " <-- '" + value + "'");
(*this).set (name, evaluated); (*this).set (name, value);
} }
++modCount; ++modCount;