mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-27 19:17:19 +02:00
Duration
- Removed legacy duration value mapping, which causes much performance degradation.
This commit is contained in:
parent
f0cc0151b7
commit
7665d13d42
6 changed files with 17 additions and 129 deletions
|
@ -166,48 +166,3 @@ void legacyAttributeMap (std::string& name)
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// TODO Is this needed, given Task::upgradeLegacyValues?
|
||||
void legacyValueMap (const std::string& name, std::string& value)
|
||||
{
|
||||
// 2014-07-03: One-time initialization value mapping.
|
||||
static std::map <std::string, std::string> mapping;
|
||||
if (mapping.size () == 0)
|
||||
{
|
||||
mapping["hrs"] = "hours";
|
||||
mapping["hr"] = "hours";
|
||||
mapping["mins"] = "minutes";
|
||||
mapping["mnths"] = "months";
|
||||
mapping["mths"] = "months";
|
||||
mapping["mth"] = "months";
|
||||
mapping["mos"] = "months";
|
||||
mapping["m"] = "months"; // ?
|
||||
mapping["qrtrs"] = "quarters";
|
||||
mapping["qtrs"] = "quarters";
|
||||
mapping["qtr"] = "quarters";
|
||||
mapping["secs"] = "seconds";
|
||||
mapping["sec"] = "seconds";
|
||||
mapping["s"] = "seconds"; // ?
|
||||
mapping["wks"] = "weeks";
|
||||
mapping["wk"] = "weeks";
|
||||
mapping["yrs"] = "years";
|
||||
mapping["yr"] = "years";
|
||||
}
|
||||
|
||||
if (name == "recur")
|
||||
{
|
||||
std::size_t letter = value.find_first_not_of ("0123456789.");
|
||||
if (letter == std::string::npos)
|
||||
letter = 0;
|
||||
|
||||
std::map <std::string, std::string>::iterator i = mapping.find (value.substr (letter));
|
||||
if (i != mapping.end ())
|
||||
{
|
||||
if (letter)
|
||||
value = value.substr (0, letter) + i->second;
|
||||
else
|
||||
value = i->second;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue