Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
whats-open
Commits
c8b2b9ba
Commit
c8b2b9ba
authored
Dec 09, 2013
by
Renfred Harper
Browse files
Sort schedules by open_time
parent
7109b57e
Changes
1
Hide whitespace changes
Inline
Side-by-side
website/api.py
View file @
c8b2b9ba
...
...
@@ -16,7 +16,10 @@ def export_data():
'id'
:
restaurant
.
id
}
open_times
=
list
()
for
time
in
restaurant
.
main_schedule
.
open_times
.
all
():
# Sort open times by their start day and time
sorted_times
=
sorted
(
restaurant
.
main_schedule
.
open_times
.
all
(),
key
=
lambda
t
:
(
t
.
start_day
,
t
.
start_time
,
t
.
end_time
))
for
time
in
sorted_times
:
open_times
.
append
({
'start_day'
:
time
.
start_day
,
'start_time'
:
time
.
start_time
.
isoformat
(),
...
...
@@ -30,7 +33,9 @@ def export_data():
special_schedules
=
list
()
for
schedule
in
restaurant
.
special_schedules
.
all
():
open_times
=
list
()
for
time
in
schedule
.
open_times
.
all
():
sorted_times
=
sorted
(
schedule
.
open_times
.
all
(),
key
=
lambda
t
:
(
t
.
start_day
,
t
.
start_time
,
t
.
end_time
))
for
time
in
sorted_times
:
open_times
.
append
({
'start_day'
:
time
.
start_day
,
'start_time'
:
time
.
start_time
.
isoformat
(),
...
...
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