Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
steering
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
AURA
steering
Commits
20414ade
Verified
Commit
20414ade
authored
10 months ago
by
Ernesto Rico Schmidt
Browse files
Options
Downloads
Patches
Plain Diff
style: rename varibles for readability
parent
a041569b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
program/services.py
+25
-27
25 additions, 27 deletions
program/services.py
with
25 additions
and
27 deletions
program/services.py
+
25
−
27
View file @
20414ade
...
...
@@ -633,7 +633,7 @@ def generate_conflicts(timeslots: list[TimeSlot]) -> Conflicts:
solutions
=
{}
# Cycle each timeslot
for
t
s
in
timeslots
:
for
t
imeslot
in
timeslots
:
# Contains collisions
collisions
=
[]
...
...
@@ -641,31 +641,31 @@ def generate_conflicts(timeslots: list[TimeSlot]) -> Conflicts:
solution_choices
=
set
()
# Get collisions for each timeslot
colli
sion_list
=
list
(
get_colliding_timeslots
(
t
s
).
order_by
(
"
start
"
))
colli
ding_timeslots
=
list
(
get_colliding_timeslots
(
t
imeslot
).
order_by
(
"
start
"
))
# Add the projected timeslot
projected_entry
=
{
"
hash
"
:
t
s
.
hash
,
"
start
"
:
str
(
t
s
.
start
),
"
end
"
:
str
(
t
s
.
end
),
"
hash
"
:
t
imeslot
.
hash
,
"
start
"
:
str
(
t
imeslot
.
start
),
"
end
"
:
str
(
t
imeslot
.
end
),
}
for
c
in
colli
sion_list
:
for
existing
in
colli
ding_timeslots
:
# Add the collision
collision
=
{
"
timeslot_id
"
:
c
.
id
,
"
start
"
:
str
(
c
.
start
),
"
end
"
:
str
(
c
.
end
),
"
playlist_id
"
:
c
.
playlist_id
,
"
show_id
"
:
c
.
schedule
.
show
.
id
,
"
show_name
"
:
c
.
schedule
.
show
.
name
,
"
schedule_id
"
:
c
.
schedule_id
,
"
memo
"
:
c
.
memo
,
"
timeslot_id
"
:
existing
.
id
,
"
start
"
:
str
(
existing
.
start
),
"
end
"
:
str
(
existing
.
end
),
"
playlist_id
"
:
existing
.
playlist_id
,
"
show_id
"
:
existing
.
schedule
.
show
.
id
,
"
show_name
"
:
existing
.
schedule
.
show
.
name
,
"
schedule_id
"
:
existing
.
schedule_id
,
"
memo
"
:
existing
.
memo
,
}
# Get note
try
:
note
=
Note
.
objects
.
get
(
timeslot
=
c
.
id
)
note
=
Note
.
objects
.
get
(
timeslot
=
existing
.
id
)
collision
[
"
note_id
"
]
=
note
.
pk
except
ObjectDoesNotExist
:
collision
[
"
note_id
"
]
=
None
...
...
@@ -674,14 +674,12 @@ def generate_conflicts(timeslots: list[TimeSlot]) -> Conflicts:
"""
Determine acceptable solutions
"""
if
len
(
collision_list
)
>
1
:
# If there is more than one collision: Only these two are supported at the
# moment
if
len
(
colliding_timeslots
)
>
1
:
# If there is more than one collision: Only these two are supported at the moment
solution_choices
.
add
(
"
theirs
"
)
solution_choices
.
add
(
"
ours
"
)
else
:
# These two are always possible: Either keep theirs and remove ours or vice
# versa
# These two are always possible: Either keep theirs and remove ours or vice versa
solution_choices
.
add
(
"
theirs
"
)
solution_choices
.
add
(
"
ours
"
)
...
...
@@ -695,7 +693,7 @@ def generate_conflicts(timeslots: list[TimeSlot]) -> Conflicts:
# | |
# +--+
#
if
t
s
.
end
>
c
.
start
>
t
s
.
start
<=
c
.
end
:
if
t
imeslot
.
end
>
existing
.
start
>
t
imeslot
.
start
<=
existing
.
end
:
solution_choices
.
add
(
"
theirs-end
"
)
solution_choices
.
add
(
"
ours-end
"
)
...
...
@@ -709,11 +707,11 @@ def generate_conflicts(timeslots: list[TimeSlot]) -> Conflicts:
# | |
# +--+
#
if
c
.
start
<=
t
s
.
start
<
c
.
end
<
t
s
.
end
:
if
existing
.
start
<=
t
imeslot
.
start
<
existing
.
end
<
t
imeslot
.
end
:
solution_choices
.
add
(
"
theirs-start
"
)
solution_choices
.
add
(
"
ours-start
"
)
# Fully overlapping: projected starts earlier and ends later than existing
# Fully overlapping
/Superset
: projected starts earlier and ends later than existing
#
# ex. pr.
# +--+
...
...
@@ -722,12 +720,12 @@ def generate_conflicts(timeslots: list[TimeSlot]) -> Conflicts:
# +--+ | |
# +--+
#
if
t
s
.
start
<
c
.
start
and
t
s
.
end
>
c
.
end
:
if
t
imeslot
.
start
<
existing
.
start
and
t
imeslot
.
end
>
existing
.
end
:
solution_choices
.
add
(
"
theirs-end
"
)
solution_choices
.
add
(
"
theirs-start
"
)
solution_choices
.
add
(
"
theirs-both
"
)
# Fully overlapping: projected starts later and ends earlier than existing
# Fully overlapping
/Subset
: projected starts later and ends earlier than existing
#
# ex. pr.
# +--+
...
...
@@ -736,13 +734,13 @@ def generate_conflicts(timeslots: list[TimeSlot]) -> Conflicts:
# | | +--+
# +--+
#
if
t
s
.
start
>
c
.
start
and
t
s
.
end
<
c
.
end
:
if
t
imeslot
.
start
>
existing
.
start
and
t
imeslot
.
end
<
existing
.
end
:
solution_choices
.
add
(
"
ours-end
"
)
solution_choices
.
add
(
"
ours-start
"
)
solution_choices
.
add
(
"
ours-both
"
)
if
len
(
collisions
)
>
0
:
solutions
[
t
s
.
hash
]
=
""
solutions
[
t
imeslot
.
hash
]
=
""
projected_entry
[
"
collisions
"
]
=
collisions
projected_entry
[
"
solution_choices
"
]
=
solution_choices
...
...
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