mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Code Cleanup
- Unnecessary test replaced by an assertion.
This commit is contained in:
parent
573e0b2a65
commit
08b37c9943
1 changed files with 9 additions and 14 deletions
13
src/Task.cpp
13
src/Task.cpp
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <assert.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <Context.h>
|
#include <Context.h>
|
||||||
|
@ -1494,25 +1495,19 @@ float Task::urgency_due () const
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
float Task::urgency_age () const
|
float Task::urgency_age () const
|
||||||
{
|
{
|
||||||
if (has ("entry"))
|
assert (has ("entry"));
|
||||||
{
|
|
||||||
Date now;
|
Date now;
|
||||||
Date entry (get_date ("entry"));
|
Date entry (get_date ("entry"));
|
||||||
int age = (now - entry) / 86400; // in days
|
int age = (now - entry) / 86400; // in days
|
||||||
float max = context.config.getReal ("urgency.age.max");
|
float max = context.config.getReal ("urgency.age.max");
|
||||||
|
|
||||||
if (max == 0)
|
if (max == 0 || age > max)
|
||||||
return 1.0;
|
return 1.0;
|
||||||
|
|
||||||
if (age > max)
|
|
||||||
return 1.0;
|
|
||||||
else
|
|
||||||
return (1.0 * age/max);
|
return (1.0 * age/max);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
float Task::urgency_blocking () const
|
float Task::urgency_blocking () const
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue