Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hub
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Package registry
Operate
Terraform modules
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
thomasDOTwtf
hub
Commits
b9198be2
Commit
b9198be2
authored
Dec 20, 2021
by
Andreas Hubel
Browse files
Options
Downloads
Patches
Plain Diff
schedule import: support classic rooms + cleanup
parent
d3a7ec7c
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/api/views/schedule.py
+3
-1
3 additions, 1 deletion
src/api/views/schedule.py
src/core/schedules/schedulejson.py
+12
-10
12 additions, 10 deletions
src/core/schedules/schedulejson.py
src/core/schedules/schedulexml.py
+0
-1
0 additions, 1 deletion
src/core/schedules/schedulexml.py
with
15 additions
and
12 deletions
src/api/views/schedule.py
+
3
−
1
View file @
b9198be2
...
@@ -166,4 +166,6 @@ class EventSchedule(ConferenceSlugMixin, APIView):
...
@@ -166,4 +166,6 @@ class EventSchedule(ConferenceSlugMixin, APIView):
def
filter_additional_data
(
data
):
def
filter_additional_data
(
data
):
return
{
k
:
v
for
k
,
v
in
data
.
items
()
if
k
not
in
[
'
guid
'
,
'
slug
'
,
'
room
'
,
'
start
'
,
'
date
'
,
'
duration
'
,
'
track
'
]}
return
{
k
:
v
for
k
,
v
in
data
.
items
()
if
(
v
and
k
not
in
[
'
guid
'
,
'
slug
'
,
'
room
'
,
'
start
'
,
'
date
'
,
'
duration
'
,
'
title
'
,
'
abstract
'
,
'
description
'
,
'
language
'
])}
This diff is collapsed.
Click to expand it.
src/core/schedules/schedulejson.py
+
12
−
10
View file @
b9198be2
...
@@ -40,10 +40,7 @@ class ScheduleJSONSupport(BaseScheduleSupport):
...
@@ -40,10 +40,7 @@ class ScheduleJSONSupport(BaseScheduleSupport):
return
{
return
{
"
rooms
"
:
{
"
rooms
"
:
{
name
:
{
r
[
'
name
'
]:
r
for
r
in
schedule
.
rooms
()
"
name
"
:
name
,
"
description
"
:
""
}
for
name
in
schedule
.
rooms
()
},
},
"
events
"
:
{
"
events
"
:
{
e
.
get
(
'
id
'
):
{
e
.
get
(
'
id
'
):
{
...
@@ -57,7 +54,6 @@ class ScheduleJSONSupport(BaseScheduleSupport):
...
@@ -57,7 +54,6 @@ class ScheduleJSONSupport(BaseScheduleSupport):
"
room
"
:
e
.
get
(
'
room
'
),
"
room
"
:
e
.
get
(
'
room
'
),
"
schedule_start
"
:
e
.
get
(
'
date
'
),
"
schedule_start
"
:
e
.
get
(
'
date
'
),
"
schedule_duration
"
:
str
(
schedulexml_time_to_timedelta
(
e
.
get
(
'
duration
'
))),
"
schedule_duration
"
:
str
(
schedulexml_time_to_timedelta
(
e
.
get
(
'
duration
'
))),
# "schedule_end": e.get('date') + schedulexml_time_to_timedelta(),
"
additional_data
"
:
filter_additional_data
(
e
)
"
additional_data
"
:
filter_additional_data
(
e
)
}
for
e
in
schedule
.
events
()
}
for
e
in
schedule
.
events
()
}
}
...
@@ -69,10 +65,8 @@ class ScheduleJSON:
...
@@ -69,10 +65,8 @@ class ScheduleJSON:
Schedule from JSON document
Schedule from JSON document
'''
'''
_schedule
=
None
_schedule
=
None
tz
=
None
def
__init__
(
self
,
json
):
def
__init__
(
self
,
json
):
# self.tz = pytz.timezone()
self
.
_schedule
=
json
self
.
_schedule
=
json
@classmethod
@classmethod
...
@@ -100,11 +94,19 @@ class ScheduleJSON:
...
@@ -100,11 +94,19 @@ class ScheduleJSON:
return
self
.
_schedule
.
get
(
'
conference
'
).
get
(
'
days
'
)
return
self
.
_schedule
.
get
(
'
conference
'
).
get
(
'
days
'
)
def
rooms
(
self
):
def
rooms
(
self
):
rooms
=
set
()
# try to access the room dict from schedule.json gen 2021
for
r
in
self
.
_schedule
.
get
(
'
conference
'
,
{}).
get
(
'
rooms
'
,
[])
:
rooms
=
self
.
_schedule
.
get
(
'
conference
'
,
{}).
get
(
'
rooms
'
,
[])
rooms
.
add
(
r
.
get
(
'
name
'
))
if
rooms
:
return
list
(
rooms
)
return
list
(
rooms
)
# looks like we have an older schudule.json (gen 2020), without a dedicated room list
# so we have use a fallback and iterate all days adding the rooms to a set, creating uniqueness
rooms
=
set
()
for
day
in
self
.
days
():
for
roomname
in
day
.
get
(
'
rooms
'
):
rooms
.
add
(
roomname
)
return
list
([{
"
name
"
:
name
}
for
name
in
rooms
])
def
events
(
self
):
def
events
(
self
):
for
day
in
self
.
days
():
for
day
in
self
.
days
():
for
room
in
day
.
get
(
'
rooms
'
):
for
room
in
day
.
get
(
'
rooms
'
):
...
...
This diff is collapsed.
Click to expand it.
src/core/schedules/schedulexml.py
+
0
−
1
View file @
b9198be2
...
@@ -99,7 +99,6 @@ class ScheduleXML:
...
@@ -99,7 +99,6 @@ class ScheduleXML:
def
days
(
self
):
def
days
(
self
):
return
self
.
_schedule
.
findall
(
'
day
'
)
return
self
.
_schedule
.
findall
(
'
day
'
)
# TODO use new room guids
def
rooms
(
self
):
def
rooms
(
self
):
rooms
=
{}
rooms
=
{}
for
day
in
self
.
days
():
for
day
in
self
.
days
():
...
...
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