forked from GithubBackups/healthchecks
Extend to month.
This commit is contained in:
parent
d1c07d89a6
commit
1fe12d46fc
@ -18,8 +18,8 @@ class NameTagsForm(forms.Form):
|
|||||||
|
|
||||||
|
|
||||||
class TimeoutForm(forms.Form):
|
class TimeoutForm(forms.Form):
|
||||||
timeout = forms.IntegerField(min_value=60, max_value=604800)
|
timeout = forms.IntegerField(min_value=60, max_value=2592000)
|
||||||
grace = forms.IntegerField(min_value=60, max_value=604800)
|
grace = forms.IntegerField(min_value=60, max_value=2592000)
|
||||||
|
|
||||||
|
|
||||||
class AddChannelForm(forms.ModelForm):
|
class AddChannelForm(forms.ModelForm):
|
||||||
|
@ -8,9 +8,13 @@ def hc_duration(td):
|
|||||||
total = int(td.total_seconds() / 60)
|
total = int(td.total_seconds() / 60)
|
||||||
total, m = divmod(total, 60)
|
total, m = divmod(total, 60)
|
||||||
total, h = divmod(total, 24)
|
total, h = divmod(total, 24)
|
||||||
w, d = divmod(total, 7)
|
o, rem = divmod(total, 30)
|
||||||
|
w, d = divmod(rem, 7)
|
||||||
|
|
||||||
result = ""
|
result = ""
|
||||||
|
if o:
|
||||||
|
result += "1 month " if w == 0 else "%d months " % w
|
||||||
|
|
||||||
if w:
|
if w:
|
||||||
result += "1 week " if w == 1 else "%d weeks " % w
|
result += "1 week " if w == 1 else "%d weeks " % w
|
||||||
|
|
||||||
|
@ -4,10 +4,12 @@ $(function () {
|
|||||||
total = Math.floor(total / 60);
|
total = Math.floor(total / 60);
|
||||||
var m = total % 60; total = Math.floor(total / 60);
|
var m = total % 60; total = Math.floor(total / 60);
|
||||||
var h = total % 24; total = Math.floor(total / 24);
|
var h = total % 24; total = Math.floor(total / 24);
|
||||||
var d = total % 7; total = Math.floor(total / 7);
|
var d = total % 30 % 7;
|
||||||
var w = total;
|
var o = Math.floor(total / 30);
|
||||||
|
var w = Math.floor(total % 30 / 7);
|
||||||
|
|
||||||
var result = "";
|
var result = "";
|
||||||
|
if (o) result += o + (o === 1 ? " month " : " months ");
|
||||||
if (w) result += w + (w === 1 ? " week " : " weeks ");
|
if (w) result += w + (w === 1 ? " week " : " weeks ");
|
||||||
if (d) result += d + (d === 1 ? " day " : " days ");
|
if (d) result += d + (d === 1 ? " day " : " days ");
|
||||||
if (h) result += h + (h === 1 ? " hour " : " hours ");
|
if (h) result += h + (h === 1 ? " hour " : " hours ");
|
||||||
@ -23,12 +25,13 @@ $(function () {
|
|||||||
range: {
|
range: {
|
||||||
'min': [60, 60],
|
'min': [60, 60],
|
||||||
'30%': [3600, 3600],
|
'30%': [3600, 3600],
|
||||||
'82.80%': [86400, 86400],
|
'50%': [86400, 86400],
|
||||||
'max': 604800
|
'80%': [604800, 604800],
|
||||||
|
'max': 2592000,
|
||||||
},
|
},
|
||||||
pips: {
|
pips: {
|
||||||
mode: 'values',
|
mode: 'values',
|
||||||
values: [60, 1800, 3600, 43200, 86400, 604800],
|
values: [60, 1800, 3600, 43200, 86400, 604800, 2592000],
|
||||||
density: 5,
|
density: 5,
|
||||||
format: {
|
format: {
|
||||||
to: secsToText,
|
to: secsToText,
|
||||||
@ -51,12 +54,13 @@ $(function () {
|
|||||||
range: {
|
range: {
|
||||||
'min': [60, 60],
|
'min': [60, 60],
|
||||||
'30%': [3600, 3600],
|
'30%': [3600, 3600],
|
||||||
'82.80%': [86400, 86400],
|
'50%': [86400, 86400],
|
||||||
'max': 604800
|
'80%': [604800, 604800],
|
||||||
|
'max': 2592000,
|
||||||
},
|
},
|
||||||
pips: {
|
pips: {
|
||||||
mode: 'values',
|
mode: 'values',
|
||||||
values: [60, 1800, 3600, 43200, 86400, 604800],
|
values: [60, 1800, 3600, 43200, 86400, 604800, 2592000],
|
||||||
density: 5,
|
density: 5,
|
||||||
format: {
|
format: {
|
||||||
to: secsToText,
|
to: secsToText,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user