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
P
panikweb
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
panikweb
Commits
95b0d81e
Commit
95b0d81e
authored
Aug 25, 2013
by
fred
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add time labels when it doesn't match actual cell
parent
2a269ef5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
3 deletions
+30
-3
panikweb/views.py
panikweb/views.py
+17
-1
panikweb_templates/templates/grid.html
panikweb_templates/templates/grid.html
+13
-2
No files found.
panikweb/views.py
View file @
95b0d81e
...
...
@@ -191,12 +191,28 @@ class Grid(TemplateView):
# this handles case A (see comment above)
for
schedule
in
current_cell_schedules
:
if
schedule
in
same_cell_below
.
schedules
:
print
'removing schedule:'
,
schedule
same_cell_below
.
schedules
.
remove
(
schedule
)
elif
same_cell_below
.
schedules
and
\
current_cell_schedules
.
issuperset
(
same_cell_below
.
schedules
):
# this handles case B (see comment above)
# we set the cell time label to the longest
# period
grid
[
i
][
j
].
time_label
=
same_cell_below
.
time_label
# then we sort emissions so the longest are
# put first
grid
[
i
][
j
].
schedules
.
sort
(
lambda
x
,
y
:
-
cmp
(
x
.
get_duration
(),
y
.
get_duration
()))
# then we add individual time labels to the
# other schedules
for
schedule
in
current_cell_schedules
:
if
schedule
not
in
same_cell_below
.
schedules
:
end_time
=
schedule
.
datetime
+
timedelta
(
minutes
=
schedule
.
get_duration
())
schedule
.
time_label
=
'%02d:%02d-%02d:%02d'
%
(
schedule
.
datetime
.
hour
,
schedule
.
datetime
.
minute
,
end_time
.
hour
,
end_time
.
minute
)
grid
[
i
][
j
].
h
+=
1
grid
[
i
+
cursor
].
remove
(
same_cell_below
)
cursor
+=
1
...
...
panikweb_templates/templates/grid.html
View file @
95b0d81e
...
...
@@ -47,8 +47,19 @@
<strong>
<a
href=
"{% url 'emission-view' slug=schedule.emission.slug %}"
>
{{ schedule.emission.title }}
</a>
</strong>
<br
/>
{% if schedule.weeks_string %}
({{ schedule.weeks_string }})
<br
/>
{% if schedule.weeks_string or schedule.time_label %}
{% spaceless %}
<span>
(
</span>
{% if schedule.time_label %}
<span>
{{ schedule.time_label }}
</span>
{% if schedule.weeks_string %}
<span>
,
</span>
{% endif %}
{% endif %}
{% if schedule.weeks_string %}
<span>
{{ schedule.weeks_string }}
</span>
{% endif %}
<span>
)
</span>
{% endspaceless %}
{% endif %}
</div>
{% endfor %}
...
...
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