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
Felix Blanke
AKPlanning
Commits
71c4ac46
Commit
71c4ac46
authored
3 months ago
by
Felix Blanke
Browse files
Options
Downloads
Patches
Plain Diff
Address findings
parent
bf157dc3
No related branches found
No related tags found
1 merge request
!7
Encapsulate discretization in Event::discretize_timeslots
Pipeline
#269196
passed
3 months ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
AKModel/models.py
+10
-0
10 additions, 0 deletions
AKModel/models.py
AKModel/views/ak.py
+1
-1
1 addition, 1 deletion
AKModel/views/ak.py
with
11 additions
and
1 deletion
AKModel/models.py
+
10
−
0
View file @
71c4ac46
...
...
@@ -383,6 +383,16 @@ class Event(models.Model):
)
def
discretize_timeslots
(
self
,
*
,
slots_in_an_hour
:
float
=
1.0
)
->
Iterable
[
TimeslotBlock
]:
""""
Choose discretization scheme.
Uses default_time_slots if the event has any DefaultSlot, otherwise uniform_time_slots.
:param slots_in_an_hour: The percentage of an hour covered by a single slot.
Determines the discretization granularity.
:yield: Block of optimizer timeslots as the discretization result.
:ytype: list of TimeslotBlock
"""
if
DefaultSlot
.
objects
.
filter
(
event
=
self
).
exists
():
# discretize default slots if they exists
yield
from
merge_blocks
(
self
.
default_time_slots
(
slots_in_an_hour
=
slots_in_an_hour
))
...
...
This diff is collapsed.
Click to expand it.
AKModel/views/ak.py
+
1
−
1
View file @
71c4ac46
...
...
@@ -9,7 +9,7 @@ from django.views.generic import ListView, DetailView
from
AKModel.availability.models
import
Availability
from
AKModel.metaviews.admin
import
AdminViewMixin
,
FilterByEventSlugMixin
,
EventSlugMixin
,
IntermediateAdminView
,
\
IntermediateAdminActionView
from
AKModel.models
import
AKRequirement
,
AKSlot
,
DefaultSlot
,
Event
,
AKOrgaMessage
,
AK
,
Room
,
AKOwner
,
merge_blocks
from
AKModel.models
import
AKRequirement
,
AKSlot
,
Event
,
AKOrgaMessage
,
AK
,
Room
,
AKOwner
class
AKRequirementOverview
(
AdminViewMixin
,
FilterByEventSlugMixin
,
ListView
):
...
...
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