Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
website
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Video AG Infrastruktur
website
Commits
a2c7d46c
Commit
a2c7d46c
authored
8 years ago
by
Andreas Valder
Browse files
Options
Downloads
Patches
Plain Diff
made it posible to select the week to schow in the schedule
fixed bugs who the hell inserts lectures with zero duration?!?
parent
0a813aeb
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
server.py
+10
-5
10 additions, 5 deletions
server.py
templates/macros.html
+1
-0
1 addition, 0 deletions
templates/macros.html
templates/schedule.html
+7
-0
7 additions, 0 deletions
templates/schedule.html
with
18 additions
and
5 deletions
server.py
+
10
−
5
View file @
a2c7d46c
...
...
@@ -198,7 +198,11 @@ def auth(): # For use with nginx auth_request
@register_navbar
(
'
Drehplan
'
,
'
calendar
'
)
@mod_required
def
schedule
():
start
=
date
.
today
()
-
timedelta
(
days
=
date
.
today
().
weekday
()
+
7
*
20
)
if
'
kw
'
not
in
request
.
args
:
kw
=
0
else
:
kw
=
int
(
request
.
args
[
'
kw
'
])
start
=
date
.
today
()
-
timedelta
(
days
=
date
.
today
().
weekday
()
-
7
*
kw
)
days
=
[{
'
date
'
:
start
,
'
lectures
'
:
[],
'
atonce
'
:
0
,
'
index
'
:
0
}]
earlieststart
=
time
(
23
,
59
)
latestend
=
time
(
0
,
0
)
...
...
@@ -221,7 +225,8 @@ def schedule():
freecol
=
[];
for
l
in
i
[
'
lectures
'
]:
l
[
'
time_asdate
'
]
=
datetime
.
strptime
(
l
[
'
time
'
],
'
%Y-%m-%d %H:%M:%S
'
)
l
[
'
end_asdate
'
]
=
l
[
'
time_asdate
'
]
+
timedelta
(
minutes
=
l
[
'
duration
'
])
# who the hell inserts lectures with zero length?!?!?
l
[
'
end_asdate
'
]
=
l
[
'
time_asdate
'
]
+
timedelta
(
minutes
=
max
(
l
[
'
duration
'
],
1
))
for
l
in
sorted
([(
l
[
'
time_asdate
'
],
True
,
l
)
for
l
in
i
[
'
lectures
'
]]
+
[(
l
[
'
end_asdate
'
],
False
,
l
)
for
l
in
i
[
'
lectures
'
]],
key
=
lambda
t
:(
t
[
0
],
t
[
1
])):
if
l
[
1
]:
curcol
+=
1
...
...
@@ -240,12 +245,12 @@ def schedule():
i
[
'
maxcol
'
]
=
max
(
maxcol
,
1
)
times
=
[]
s
=
min
(
earlieststart
,
time
(
8
,
0
))
e
=
max
(
latestend
,
time
(
20
,
0
))
for
i
in
range
(
s
.
hour
*
4
,
int
(
60
*
e
.
hour
/
15
)):
e
=
max
(
latestend
,
time
(
19
,
0
))
for
i
in
range
(
s
.
hour
*
4
,
min
(
int
(
(
60
*
e
.
hour
/
15
)
/
4
)
*
4
+
5
,
24
*
4
)
):
t
=
i
*
15
times
.
append
(
time
(
int
(
t
/
60
),
t
%
60
))
return
render_template
(
'
schedule.html
'
,
days
=
days
,
times
=
times
)
return
render_template
(
'
schedule.html
'
,
days
=
days
,
times
=
times
,
kw
=
kw
)
@app.route
(
'
/stats
'
)
@register_navbar
(
'
Statistiken
'
,
'
stats
'
)
...
...
This diff is collapsed.
Click to expand it.
templates/macros.html
+
1
−
0
View file @
a2c7d46c
...
...
@@ -130,6 +130,7 @@ $('#embedcodebtn').popover(
<li>
{{ valueeditor(['lectures',lecture.id,'title'], lecture.title) }}
</li>
{% if lecture.speaker or ismod() %}
<li>
Gehalten von {{ valueeditor(['lectures',lecture.id,'speaker'], lecture.speaker) }}
</li>
{% endif %}
<li>
{{ valueeditor(['lectures',lecture.id,'time'], lecture.time) }}
</li>
<li>
Dauer: {{ valueeditor(['lectures',lecture.id,'duration'], lecture.duration) }} min
</li>
{% if ismod() %}
{% endif %}
</ul>
...
...
This diff is collapsed.
Click to expand it.
templates/schedule.html
+
7
−
0
View file @
a2c7d46c
...
...
@@ -5,6 +5,13 @@
<div
class=
"panel-heading"
>
<h1
class=
"panel-title"
>
Drehplan
</h1>
</div>
<div
class=
"row"
>
<div
style=
"margin-top: 10px;"
class=
"col-xs-12"
>
<a
href=
"{{url_for('schedule', kw=kw-1) }}"
class=
"pull-left btn btn-default"
>
{{ "
<
<"
}}</
a
>
<a
href=
"{{url_for('schedule', kw=kw+1) }}"
class=
"pull-right btn btn-default"
>
{{ ">>" }}
</a>
<a
href=
"{{url_for('schedule', kw=0) }}"
style=
"width: 80px;"
class=
"center-block btn btn-default"
>
today
</a>
</div>
</div>
<div
class=
"panel-body row table-responsive"
>
<table
class=
"table-bordered col-xs-12"
>
<tr><th></th>
{% for d in days if (d.index
<
5)
or
(
d.lectures
|
length
)
>
0%}
<th
colspan=
"{{d.maxcol}}"
>
{{ d.date.strftime("%A (%d.%m.%Y)") }}
</th>
{% endfor %}
</tr>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment