From 08b37c99434b8fc96f36d227b29af013a2c703c1 Mon Sep 17 00:00:00 2001 From: Louis-Claude Canon Date: Mon, 9 Jul 2012 11:10:05 +0200 Subject: [PATCH] Code Cleanup - Unnecessary test replaced by an assertion. --- src/Task.cpp | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/Task.cpp b/src/Task.cpp index 522e3d276..571ed904d 100644 --- a/src/Task.cpp +++ b/src/Task.cpp @@ -29,6 +29,7 @@ #include #include +#include #include #include #include @@ -1494,23 +1495,17 @@ float Task::urgency_due () const //////////////////////////////////////////////////////////////////////////////// float Task::urgency_age () const { - if (has ("entry")) - { - Date now; - Date entry (get_date ("entry")); - int age = (now - entry) / 86400; // in days - float max = context.config.getReal ("urgency.age.max"); + assert (has ("entry")); - if (max == 0) - return 1.0; + Date now; + Date entry (get_date ("entry")); + int age = (now - entry) / 86400; // in days + float max = context.config.getReal ("urgency.age.max"); - if (age > max) - return 1.0; - else - return (1.0 * age/max); - } + if (max == 0 || age > max) + return 1.0; - return 0.0; + return (1.0 * age/max); } ////////////////////////////////////////////////////////////////////////////////