Skip to content

Commit

Permalink
Return listings display time out in months instead of weeks if device…
Browse files Browse the repository at this point in the history
…s has been out for 2 or more months
  • Loading branch information
arc12012 committed Dec 3, 2016
1 parent 2235bcd commit b15348f
Showing 1 changed file with 25 additions and 23 deletions.
48 changes: 25 additions & 23 deletions html/javascript/return.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,32 +64,32 @@ function filterDeviceList()
switch(id)
{
case "all":
populateDeviceList(null);
break;
populateDeviceList(null);
break;
case "1month":
upperbound=new Date().getTime();
lowerbound=upperbound-month;
filter=[lowerbound, upperbound];
populateDeviceList(filter);
break;
upperbound=new Date().getTime();
lowerbound=upperbound-month;
filter=[lowerbound, upperbound];
populateDeviceList(filter);
break;
case "1-3months":
upperbound=new Date().getTime()-month;
lowerbound=upperbound-2*month;
filter=[lowerbound, upperbound];
populateDeviceList(filter);
break;
upperbound=new Date().getTime()-month;
lowerbound=upperbound-2*month;
filter=[lowerbound, upperbound];
populateDeviceList(filter);
break;
case "3-5months":
upperbound=new Date().getTime()-3*month;
lowerbound=upperbound-2*month;
filter=[lowerbound, upperbound];
populateDeviceList(filter);
break;
upperbound=new Date().getTime()-3*month;
lowerbound=upperbound-2*month;
filter=[lowerbound, upperbound];
populateDeviceList(filter);
break;
case "5+months":
upperbound=new Date().getTime()-5*month;
lowerbound=0;
filter=[lowerbound, upperbound];
populateDeviceList(filter);
break;
upperbound=new Date().getTime()-5*month;
lowerbound=0;
filter=[lowerbound, upperbound];
populateDeviceList(filter);
break;
}
}

Expand All @@ -116,7 +116,9 @@ function populateDeviceList(filter)
var hours=Math.floor(minutes/60);
var days=Math.floor(hours/24);
var weeks=Math.floor(days/7);
htmlString+= weeks+ " weeks!";
var months=Math.floor(weeks/4);
if(months>=2) htmlString+=months+" months";
else htmlString+= weeks+ " weeks";
htmlString+="</div><div class=\"returnButtonContainer\"><button class=\"returnbutton\" id=\"button ";
htmlString+=(id);
htmlString+="\" type=\"button\">Return ";
Expand Down

0 comments on commit b15348f

Please sign in to comment.