Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hub
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Package registry
Operate
Terraform modules
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
thomasDOTwtf
hub
Commits
01f286ad
Commit
01f286ad
authored
6 months ago
by
Roang
Browse files
Options
Downloads
Patches
Plain Diff
Fix leftover channel targets in voucher model
parent
15a87853
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/core/models/voucher.py
+4
-4
4 additions, 4 deletions
src/core/models/voucher.py
with
4 additions
and
4 deletions
src/core/models/voucher.py
+
4
−
4
View file @
01f286ad
...
...
@@ -124,7 +124,7 @@ class Voucher(models.Model):
def
do_auto_assignments
(
cls
,
conference
:
Conference
=
None
,
assemblies
:
list
[
Assembly
]
|
None
=
None
)
->
int
:
qs
=
cls
.
objects
.
filter
(
conference
=
conference
)
if
conference
is
not
None
else
cls
.
objects
.
all
()
qs
=
qs
.
filter
(
enabled
=
True
)
qs
=
qs
.
filter
(
target
__in
=
Voucher
.
ASSEMBLY
_TARGETS
)
qs
=
qs
.
filter
(
target
=
Voucher
.
Target
.
ASSEMBLY
)
total
=
0
for
voucher
in
qs
.
iterator
():
...
...
@@ -137,7 +137,7 @@ class Voucher(models.Model):
return
total
def
do_auto_assignment
(
self
,
assemblies
:
list
[
Assembly
])
->
int
:
if
self
.
target
not
in
self
.
ASSEMBLY_TARGETS
:
if
self
.
target
!=
self
.
Target
.
ASSEMBLY
:
raise
NotImplementedError
(
'
Auto-Assignment of non assemblies not implemented yet.
'
)
# nothing to do if we're not enabled or set to manual assignment
...
...
@@ -199,7 +199,7 @@ class VoucherEntry(models.Model):
@cached_property
def
target
(
self
):
if
self
.
voucher
.
target
in
Voucher
.
ASSEMBLY
_TARGETS
:
if
self
.
voucher
.
target
==
Voucher
.
Target
.
ASSEMBLY
:
return
self
.
assigned_assembly
if
self
.
voucher
.
target
==
Voucher
.
Target
.
USER
:
...
...
@@ -218,7 +218,7 @@ class VoucherEntry(models.Model):
else
:
# assembly assigned without a timestamp?
if
self
.
voucher
.
target
in
Voucher
.
ASSEMBLY
_TARGETS
and
self
.
assigned_assembly
is
not
None
:
if
self
.
voucher
.
target
==
Voucher
.
Target
.
ASSEMBLY
and
self
.
assigned_assembly
is
not
None
:
self
.
assigned
=
timezone
.
now
()
else
:
self
.
assigned_assembly
=
None
...
...
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