Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AKPlanning
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
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Dominik Weitz
AKPlanning
Commits
d35051c0
Commit
d35051c0
authored
11 months ago
by
Benjamin Hättasch
Browse files
Options
Downloads
Patches
Plain Diff
Restrict AKSlot duration to length of the event
This implements
#212
.
parent
dcafb769
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
AKModel/models.py
+8
-0
8 additions, 0 deletions
AKModel/models.py
AKSubmission/forms.py
+1
-1
1 addition, 1 deletion
AKSubmission/forms.py
with
9 additions
and
1 deletion
AKModel/models.py
+
8
−
0
View file @
d35051c0
...
@@ -600,6 +600,14 @@ class AKSlot(models.Model):
...
@@ -600,6 +600,14 @@ class AKSlot(models.Model):
"""
"""
return
self
.
start
<
other
.
end
<=
self
.
end
or
self
.
start
<=
other
.
start
<
self
.
end
return
self
.
start
<
other
.
end
<=
self
.
end
or
self
.
start
<=
other
.
start
<
self
.
end
def
save
(
self
,
force_insert
=
False
,
force_update
=
False
,
using
=
None
,
update_fields
=
None
):
# Make sure duration is not longer than the event
if
update_fields
is
None
or
'
duration
'
in
update_fields
:
event_duration
=
self
.
event
.
end
-
self
.
event
.
start
event_duration_hours
=
event_duration
.
days
*
24
+
event_duration
.
seconds
//
3600
self
.
duration
=
min
(
self
.
duration
,
event_duration_hours
)
super
().
save
(
force_insert
,
force_update
,
using
,
update_fields
)
class
AKOrgaMessage
(
models
.
Model
):
class
AKOrgaMessage
(
models
.
Model
):
"""
"""
...
...
This diff is collapsed.
Click to expand it.
AKSubmission/forms.py
+
1
−
1
View file @
d35051c0
...
@@ -86,7 +86,7 @@ class AKForm(AvailabilitiesFormMixin, forms.ModelForm):
...
@@ -86,7 +86,7 @@ class AKForm(AvailabilitiesFormMixin, forms.ModelForm):
duration
=
float
(
duration
.
replace
(
"
,
"
,
"
.
"
))
duration
=
float
(
duration
.
replace
(
"
,
"
,
"
.
"
))
try
:
try
:
float
(
duration
)
duration
=
float
(
duration
)
except
ValueError
as
exc
:
except
ValueError
as
exc
:
raise
ValidationError
(
raise
ValidationError
(
_
(
'"
%(duration)s
"
is not a valid duration
'
),
_
(
'"
%(duration)s
"
is not a valid duration
'
),
...
...
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