diff --git a/migrations/20210213_add_has_data_field.go b/migrations/20210213_add_has_data_field.go new file mode 100644 index 0000000..7a83bb2 --- /dev/null +++ b/migrations/20210213_add_has_data_field.go @@ -0,0 +1,20 @@ +package migrations + +import ( + "github.com/muety/wakapi/config" + "gorm.io/gorm" +) + +func init() { + f := migrationFunc{ + name: "20210213_add_has_data_field", + f: func(db *gorm.DB, cfg *config.Config) error { + if err := db.Exec("UPDATE users SET has_data = TRUE WHERE 1").Error; err != nil { + return err + } + return nil + }, + } + + registerPostMigration(f) +} diff --git a/static/assets/app.js b/static/assets/app.js index e62e147..fa0f48c 100644 --- a/static/assets/app.js +++ b/static/assets/app.js @@ -50,16 +50,9 @@ String.prototype.toHHMMSS = function () { } String.prototype.toHHMM = function () { - var sec_num = parseInt(this, 10) - var hours = Math.floor(sec_num / 3600) - var minutes = Math.floor((sec_num - (hours * 3600)) / 60) - - if (hours < 10 && hours > 0) { - hours = '0' + hours - } - if (minutes < 10 && minutes > 0) { - minutes = '0' + minutes - } + const sec_num = parseInt(this, 10) + const hours = Math.floor(sec_num / 3600) + const minutes = Math.floor((sec_num - (hours * 3600)) / 60) return hours + ':' + minutes }