Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
David Seaward
Keel - LDH Middleware
Commits
62e6a8a9
Commit
62e6a8a9
authored
Dec 12, 2017
by
David Seaward
Browse files
credit label update:
* fix reference to new enum * add months and years to label
parent
bed71975
Changes
1
Hide whitespace changes
Inline
Side-by-side
limitmonitor/models.py
View file @
62e6a8a9
...
...
@@ -77,7 +77,7 @@ class Limit(models.Model):
def
credit_label
(
self
):
if
self
.
service
==
"
TUNNEL
"
:
if
self
.
service
==
Service
.
TUNNEL
:
return
self
.
days_credit_label
()
else
:
return
self
.
days_credit_label
()
...
...
@@ -86,7 +86,13 @@ class Limit(models.Model):
single_day
=
60
*
60
*
24
days
=
int
(
round
(
delta
.
total_seconds
()
/
single_day
))
return
str
(
days
)
+
" days"
if
days
<=
62
:
return
str
(
days
)
+
" days"
elif
days
<=
744
:
return
str
(
days
//
30
)
+
" months"
else
:
return
str
(
days
//
365
)
+
" years"
def
days_credit_label
(
self
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment