Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
rhul-scripts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Hague Matthew UXAC009
rhul-scripts
Commits
f075cf4e
Commit
f075cf4e
authored
10 months ago
by
Hague Matthew UXAC009
Browse files
Options
Downloads
Patches
Plain Diff
bug(timetable): get_years should avoid duplicates
parent
2e011d34
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
timetabling/timetable-ics.py
+6
-5
6 additions, 5 deletions
timetabling/timetable-ics.py
with
6 additions
and
5 deletions
timetabling/timetable-ics.py
+
6
−
5
View file @
f075cf4e
...
...
@@ -8,7 +8,7 @@ import sys
from
icalendar
import
Calendar
,
Event
from
datetime
import
datetime
,
timedelta
from
typing
import
Dict
,
Generator
from
typing
import
Dict
,
Generator
,
Set
TIMEZONE
=
"
Europe/London
"
BASE_DATE
=
datetime
(
2024
,
9
,
23
,
0
,
0
,
0
,
0
,
pytz
.
timezone
(
TIMEZONE
))
...
...
@@ -33,12 +33,13 @@ if sys.argv[1].lower() == "-expand":
cals
=
{
year
:
Calendar
()
for
year
in
range
(
0
,
6
)
}
cals
.
update
({
BEDFORD
:
Calendar
()
})
def
get_years
(
name
:
str
)
->
Generator
[
int
,
None
,
None
]:
def
get_years
(
name
:
str
)
->
Set
[
int
]:
# remove CS2900 assessment weird names
name
=
re
.
sub
(
r
"
<[^<]*>
"
,
""
,
name
)
for
sess
in
name
.
split
(
"
,
"
):
year
=
int
(
sess
.
strip
()[
2
])
yield
year
return
set
(
int
(
sess
.
strip
()[
2
])
for
sess
in
name
.
split
(
"
,
"
)
)
def
get_weeks
(
weeks
:
str
)
->
Generator
[
int
,
None
,
None
]:
for
period
in
weeks
.
split
(
"
,
"
):
...
...
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