From 21ea57a6616cebabf89fd0ad67c378391dde5fd9 Mon Sep 17 00:00:00 2001 From: james Date: Thu, 18 Feb 2010 16:01:46 +0000 Subject: [PATCH] Remove debug and properly pluralize hours/minutes/seconds --- admin/judges_scheduler_status.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/admin/judges_scheduler_status.php b/admin/judges_scheduler_status.php index 77d2f6c..49c6f41 100644 --- a/admin/judges_scheduler_status.php +++ b/admin/judges_scheduler_status.php @@ -95,23 +95,28 @@ function format_duration(seconds) { */ var s=seconds; - var output=s+':'; + var output=''; + var pl=''; if(s>86400) { var days=Math.floor(s/86400) s-=days*86400; - output+=days+' days '; + if(days>1) pl='s'; else pl=''; + output+=days+' day'+pl+' '; } if(s>3600) { var hours=Math.floor(s/3600) s-=hours*3600; - output+=hours+' hours '; + if(hours>1) pl='s'; else pl=''; + output+=hours+' hour'+pl+' '; } if(s>60) { var minutes=Math.floor(s/60) s-=minutes*60; - output+=minutes+' minutes '; + if(minutes>1) pl='s'; else pl=''; + output+=minutes+' minute'+pl+' '; } - output+=s+' seconds '; + if(s>1) pl='s'; else pl=''; + output+=s+' second'+pl; return output; }