mirror of https://github.com/statping/statping
Merge pull request #308 from l0nax/feature/status-update
Correct Downtime Calculationpull/277/head^2
commit
db025e87d7
|
@ -260,7 +260,7 @@ func (s *Service) Downtime() time.Duration {
|
||||||
if len(hits) == 0 {
|
if len(hits) == 0 {
|
||||||
return time.Now().UTC().Sub(fail.CreatedAt.UTC())
|
return time.Now().UTC().Sub(fail.CreatedAt.UTC())
|
||||||
}
|
}
|
||||||
since := fail.CreatedAt.UTC().Sub(fail.CreatedAt.UTC())
|
since := fail.CreatedAt.UTC().Sub(hits[0].CreatedAt.UTC())
|
||||||
return since
|
return since
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
<span class="switch">
|
<span class="switch">
|
||||||
<input type="checkbox" name="update_notify-option" class="switch" id="switch-update_notify"{{if UPDATENOTIFY}} checked{{end}}>
|
<input type="checkbox" name="update_notify-option" class="switch" id="switch-update_notify"{{if UPDATENOTIFY}} checked{{end}}>
|
||||||
<label for="switch-update_notify" class="mt-2 mt-sm-0"></label>
|
<label for="switch-update_notify" class="mt-2 mt-sm-0"></label>
|
||||||
|
<small class="form-text text-muted">Enabling this will send only notifications when the status of a services changes.</small>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<input type="hidden" name="update_notify" id="switch-update_notify-value" value="{{if UPDATENOTIFY}}true{{else}}false{{end}}">
|
<input type="hidden" name="update_notify" id="switch-update_notify-value" value="{{if UPDATENOTIFY}}true{{else}}false{{end}}">
|
||||||
|
|
|
@ -37,7 +37,7 @@ type Core struct {
|
||||||
Version string `gorm:"column:version" json:"version"`
|
Version string `gorm:"column:version" json:"version"`
|
||||||
MigrationId int64 `gorm:"column:migration_id" json:"migration_id,omitempty"`
|
MigrationId int64 `gorm:"column:migration_id" json:"migration_id,omitempty"`
|
||||||
UseCdn NullBool `gorm:"column:use_cdn;default:false" json:"using_cdn,omitempty"`
|
UseCdn NullBool `gorm:"column:use_cdn;default:false" json:"using_cdn,omitempty"`
|
||||||
UpdateNotify NullBool `gorm:"column:update_notify;default:false" json:"update_notify,omitempty"`
|
UpdateNotify NullBool `gorm:"column:update_notify;default:true" json:"update_notify,omitempty"`
|
||||||
Timezone float32 `gorm:"column:timezone;default:-8.0" json:"timezone,omitempty"`
|
Timezone float32 `gorm:"column:timezone;default:-8.0" json:"timezone,omitempty"`
|
||||||
CreatedAt time.Time `gorm:"column:created_at" json:"created_at"`
|
CreatedAt time.Time `gorm:"column:created_at" json:"created_at"`
|
||||||
UpdatedAt time.Time `gorm:"column:updated_at" json:"updated_at"`
|
UpdatedAt time.Time `gorm:"column:updated_at" json:"updated_at"`
|
||||||
|
|
Loading…
Reference in New Issue