Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
django-panik-emissions
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
radiopanik
django-panik-emissions
Commits
0f2e904c
Commit
0f2e904c
authored
Dec 12, 2019
by
fred
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add method to get natural weeks order
parent
489a6b93
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
emissions/models.py
emissions/models.py
+14
-0
No files found.
emissions/models.py
View file @
0f2e904c
...
...
@@ -231,6 +231,20 @@ class Schedule(models.Model, WeekdayMixin):
return
ugettext
(
'2nd and 4th'
)
return
None
def
week_sort_key
(
self
):
order
=
[
0b1111
,
# Every week
0b0001
,
# First week
0b0101
,
# First and third week
0b0010
,
# Second week
0b1010
,
# Second and fourth week
0b0100
,
# Third week
0b1000
,
# Fourth week
]
if
self
.
weeks
in
order
:
return
order
.
index
(
self
.
weeks
)
return
-
1
def
get_duration
(
self
):
if
self
.
duration
:
return
self
.
duration
...
...
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