Merge pull request #1104 from schmitzn/fix-careportalevent

Fix bug in CareportalEvent.getHoursFromStart()
This commit is contained in:
Milos Kozak 2018-06-15 00:04:47 +02:00 committed by GitHub
commit bcabeac228
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -87,7 +87,7 @@ public class CareportalEvent implements DataPointWithLabelInterface {
} }
public long getHoursFromStart() { public long getHoursFromStart() {
return (System.currentTimeMillis() - date) / (60 * 1000); return (System.currentTimeMillis() - date) / (60 * 60 * 1000);
} }
public String age() { public String age() {
@ -98,13 +98,7 @@ public class CareportalEvent implements DataPointWithLabelInterface {
return diff.get(TimeUnit.DAYS) + " " + MainApp.gs(R.string.days) + " " + diff.get(TimeUnit.HOURS) + " " + MainApp.gs(R.string.hours); return diff.get(TimeUnit.DAYS) + " " + MainApp.gs(R.string.days) + " " + diff.get(TimeUnit.HOURS) + " " + MainApp.gs(R.string.hours);
} }
public boolean isOlderThan(double hours) { public boolean isOlderThan(double hours) { return getHoursFromStart() > hours; }
Map<TimeUnit, Long> diff = computeDiff(date, System.currentTimeMillis());
if(diff.get(TimeUnit.DAYS)*24 + diff.get(TimeUnit.HOURS) > hours)
return true;
else
return false;
}
public String log() { public String log() {
return "CareportalEvent{" + return "CareportalEvent{" +