Parse record to int when reading from storage to fix comparison

This commit is contained in:
Mikko Ahlroth 2014-02-06 23:34:54 +02:00
parent a1a559ba3f
commit bc52f567a8

View file

@ -77,7 +77,7 @@ ApplicationWindow
var hours = Math.floor(uptime_s / 3600 % 24);
var minutes = Math.floor(uptime_s / 60 % 60);
var record = Storage.readSetting(Storage.db, "record", 0);
var record = parseInt(Storage.readSetting(Storage.db, "record", 0));
var rDays = Math.floor(record / 84600);
var rHours = Math.floor(record / 3600 % 24);
var rMinutes = Math.floor(record / 60 % 60);
@ -98,8 +98,10 @@ ApplicationWindow
firstpage.updatePage(sysinfo, uptime);
coverpage.updateCover(uptime);
var recordEnable = Storage.readSetting(Storage.db, "recordEnable", false);
// Update new record to db if feature is activated
if (Storage.readSetting(Storage.db, "recordEnable", false) && uptime_s >= record) {
if (recordEnable && (uptime_s >= record)) {
Storage.storeSetting(Storage.db, "record", uptime_s);
}
}