Bug TW-1274

- TW-1274 Map 'modification' attribute to 'modified' (thanks to jck).
This commit is contained in:
Paul Beckingham 2014-02-22 11:57:21 -05:00
parent 14b1ba4151
commit 61a9703ab4
4 changed files with 36 additions and 11 deletions

View file

@ -199,4 +199,4 @@ suggestions:
Kosta H
Hector Arciga
Jan Kunder
jck

View file

@ -15,6 +15,7 @@ Features
+ TW-1260 New virtual tags YESTERDAY, TOMORROW.
+ TW-1261 Migrate test bug.360.t to new unit testing framework (thanks to
Renato Alves).
+ TW-1274 Map 'modification' attribute to 'modified' (thanks to jck).
+ Removed deprecated 'echo.command' setting, in favor of the 'header' and
'affected' verbosity tokens.
+ Removed deprecated 'edit.verbose' setting, in favor of the 'edit' verbosity

View file

@ -539,6 +539,10 @@ void Task::parse (const std::string& input)
value[value.length () - 1] == 'm')
value += 'o';
// TW-1274, Standardization.
if (name == "modification")
name = "modified";
if (name.substr (0, 11) == "annotation_")
++annotation_count;
@ -596,6 +600,13 @@ void Task::parseJSON (const std::string& line)
else if (i->first == "urgency")
;
// TW-1274 Standardization.
else if (i->first == "modification")
{
Date d (unquoteText (i->second->dump ()));
set ("modified", d.toEpochString ());
}
// Dates are converted from ISO to epoch.
else if (type == "date")
{
@ -604,7 +615,7 @@ void Task::parseJSON (const std::string& line)
}
// Tags are an array of JSON strings.
else if (i->first == "tags")
else if (i->first == "tags" && i->second->type() == json::j_array)
{
json::array* tags = (json::array*)i->second;
json_array_iter t;
@ -616,6 +627,13 @@ void Task::parseJSON (const std::string& line)
addTag (tag->_data);
}
}
// This is a temporary measure to allow Mirakel sync, and will be removed
// in a future release.
else if (i->first == "tags" && i->second->type() == json::j_string)
{
json::string* tag = (json::string*)i->second;
addTag (tag->_data);
}
// Strings are decoded.
else if (type == "string")
@ -818,7 +836,10 @@ std::string Task::composeF4 () const
{
ff4 += (first ? "" : " ")
+ it->first
+ ":\"" + encode (json::encode (it->second)) + "\"";
+ ":\""
+ encode (json::encode (it->second))
+ "\"";
first = false;
}
}
@ -858,6 +879,11 @@ std::string Task::composeJSON (bool decorate /*= false*/) const
if (type == "date")
{
Date d (i->second);
if (i->first == "modification")
out << "\"modified\":\""
<< d.toISO ()
<< "\"";
else
out << "\""
<< i->first
<< "\":\""

View file

@ -289,10 +289,8 @@ int CmdInfo::execute (std::string& output)
view.set (row, 0, STRING_CMD_INFO_MODIFIED);
Date mod (task->get_date ("modified"));
std::string age = OldDuration (now - mod).format ();
view.set (row, 1, Date (task->get_date ("modified")).toString (dateformat) +
" (" + age + ")");
view.set (row, 1, mod.toString (dateformat) + " (" + age + ")");
}
// tags ...