Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
LabCourse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
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
Tim-Oliver Husser
LabCourse
Commits
a9d5ce30
Commit
a9d5ce30
authored
1 year ago
by
Tim-Oliver Husser
Browse files
Options
Downloads
Plain Diff
Merge branch 'develop' into 'main'
v1.25.5 See merge request
!143
parents
7aa59b85
7d032925
No related branches found
No related tags found
1 merge request
!143
v1.25.5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
LabCourse/api/models.py
+12
-14
12 additions, 14 deletions
LabCourse/api/models.py
pyproject.toml
+1
-1
1 addition, 1 deletion
pyproject.toml
with
13 additions
and
15 deletions
LabCourse/api/models.py
+
12
−
14
View file @
a9d5ce30
...
...
@@ -34,10 +34,6 @@ class Semester(models.Model):
week_day
=
models
.
IntegerField
()
# 0=Mon, 1=Tue, ...
active
=
models
.
BooleanField
(
default
=
True
)
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
().
__init__
(
*
args
,
**
kwargs
)
self
.
__original_dates
=
(
self
.
lecture_start
,
self
.
lecture_end
,
self
.
week_day
)
def
__str__
(
self
):
if
self
.
semester
==
0
:
return
f
"
Winter Term
{
self
.
year
}
/
{
str
(
self
.
year
+
1
)[
-
2
:
]
}
"
...
...
@@ -70,24 +66,26 @@ class Semester(models.Model):
# set code
self
.
code
=
self
.
short_name
()
# did the dates change?
need_create_dates
=
True
if
self
.
pk
is
not
None
:
orig
=
Semester
.
objects
.
get
(
pk
=
self
.
pk
)
need_create_dates
=
(
self
.
lecture_start
!=
orig
.
lecture_start
or
self
.
lecture_end
!=
orig
.
lecture_end
or
self
.
week_day
!=
orig
.
week_day
)
# save model
super
().
save
(
*
args
,
**
kwargs
)
# deactivate all semesters except this one
Semester
.
objects
.
exclude
(
id
=
self
.
id
).
update
(
active
=
False
)
# did the dates change?
if
self
.
__original_dates
!=
(
self
.
lecture_start
,
self
.
lecture_end
,
self
.
week_day
,
):
# create dates
# create dates?
if
need_create_dates
:
self
.
_create_dates
()
# store new dates
self
.
__original_dates
=
(
self
.
lecture_start
,
self
.
lecture_end
,
self
.
week_day
)
@staticmethod
def
current
():
"""
Return current semester.
"""
...
...
This diff is collapsed.
Click to expand it.
pyproject.toml
+
1
−
1
View file @
a9d5ce30
[tool.poetry]
name
=
"labcourse"
version
=
"1.25.
4
"
version
=
"1.25.
5
"
description
=
""
authors
=
[
"Tim-Oliver Husser <thusser@uni-goettingen.de>"
]
...
...
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