Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
1ef8dbd6
authored
Dec 17, 2013
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: lease form handlew intervals longer than a year correctly
parent
e3a25fe6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
+13
-2
circle/dashboard/forms.py
+13
-2
No files found.
circle/dashboard/forms.py
View file @
1ef8dbd6
...
...
@@ -348,14 +348,25 @@ class LeaseForm(forms.ModelForm):
def
save
(
self
,
commit
=
True
):
data
=
self
.
cleaned_data
# 12 months are only 360 days and not 365
data
[
'suspend_years'
]
=
data
[
'delete_years'
]
=
0
while
data
[
'suspend_months'
]
>=
12
:
data
[
'suspend_years'
]
+=
1
data
[
'suspend_months'
]
-=
12
while
data
[
'delete_months'
]
>=
12
:
data
[
'delete_years'
]
+=
1
data
[
'delete_months'
]
-=
12
suspend_seconds
=
timedelta
(
hours
=
data
[
'suspend_hours'
],
days
=
(
data
[
'suspend_days'
]
+
data
[
'suspend_months'
]
*
30
),
days
=
(
data
[
'suspend_days'
]
+
data
[
'suspend_months'
]
*
30
+
data
[
'suspend_years'
]
*
365
),
weeks
=
data
[
'suspend_weeks'
],
)
delete_seconds
=
timedelta
(
hours
=
data
[
'delete_hours'
],
days
=
(
data
[
'delete_days'
]
+
data
[
'delete_months'
]
*
30
),
days
=
(
data
[
'delete_days'
]
+
data
[
'delete_months'
]
*
30
+
data
[
'delete_years'
]
*
365
),
weeks
=
data
[
'delete_weeks'
],
)
self
.
instance
.
delete_interval
=
delete_seconds
...
...
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