Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gyuricska Milán
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
74e7fb9a
authored
Dec 17, 2013
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: lease form fix year inaccuracy
parent
c48f9e72
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
13 deletions
+5
-13
circle/dashboard/forms.py
+5
-13
No files found.
circle/dashboard/forms.py
View file @
74e7fb9a
...
@@ -321,7 +321,7 @@ class LeaseForm(forms.ModelForm):
...
@@ -321,7 +321,7 @@ class LeaseForm(forms.ModelForm):
if
count
!=
0
:
if
count
!=
0
:
break
break
re
=
{
'
%
s'
%
name
:
count
}
re
=
{
'
%
s'
%
name
:
count
}
if
i
+
1
<
len
(
chunks
):
if
i
+
1
<
len
(
chunks
)
and
i
>
0
:
seconds2
,
name2
=
chunks
[
i
+
1
]
seconds2
,
name2
=
chunks
[
i
+
1
]
count2
=
(
delta_seconds
-
(
seconds
*
count
))
//
seconds2
count2
=
(
delta_seconds
-
(
seconds
*
count
))
//
seconds2
if
count2
!=
0
:
if
count2
!=
0
:
...
@@ -348,25 +348,17 @@ class LeaseForm(forms.ModelForm):
...
@@ -348,25 +348,17 @@ class LeaseForm(forms.ModelForm):
def
save
(
self
,
commit
=
True
):
def
save
(
self
,
commit
=
True
):
data
=
self
.
cleaned_data
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
(
suspend_seconds
=
timedelta
(
hours
=
data
[
'suspend_hours'
],
hours
=
data
[
'suspend_hours'
],
days
=
(
data
[
'suspend_days'
]
+
data
[
'suspend_months'
]
*
30
+
days
=
(
data
[
'suspend_days'
]
+
data
[
'suspend_months'
]
%
12
*
30
+
data
[
'suspend_
years'
]
*
365
),
data
[
'suspend_
months'
]
/
12
*
365
),
weeks
=
data
[
'suspend_weeks'
],
weeks
=
data
[
'suspend_weeks'
],
)
)
delete_seconds
=
timedelta
(
delete_seconds
=
timedelta
(
hours
=
data
[
'delete_hours'
],
hours
=
data
[
'delete_hours'
],
days
=
(
data
[
'delete_days'
]
+
data
[
'delete_months'
]
*
30
+
days
=
(
data
[
'delete_days'
]
+
data
[
'delete_months'
]
%
12
*
30
+
data
[
'delete_
years'
]
*
365
),
data
[
'delete_
months'
]
/
12
*
365
),
weeks
=
data
[
'delete_weeks'
],
weeks
=
data
[
'delete_weeks'
],
)
)
self
.
instance
.
delete_interval
=
delete_seconds
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