Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
third-party
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cooperatic-foodcoops
third-party
Commits
a7254e35
Commit
a7254e35
authored
Feb 01, 2024
by
Yvon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
properly set template_created when reopening registration not as a makeup
parent
53aec0df
Pipeline
#3284
failed with stage
in 1 minute 7 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
models.py
shifts/models.py
+10
-4
No files found.
shifts/models.py
View file @
a7254e35
...
@@ -328,11 +328,17 @@ class CagetteShift(models.Model):
...
@@ -328,11 +328,17 @@ class CagetteShift(models.Model):
"state"
:
'open'
,
"state"
:
'open'
,
"is_makeup"
:
data
[
'is_makeup'
],
"is_makeup"
:
data
[
'is_makeup'
],
"origin"
:
canceled_res
[
0
][
'origin'
]
+
' reopened from memberspace'
}
"origin"
:
canceled_res
[
0
][
'origin'
]
+
' reopened from memberspace'
}
"""In case shift to reopen is a makeup, we want the counter to be incremented once shift is done
That is why template_created must be set to false
#following code is required to properly set template_created.
However if shift to reopen is not a makeup, counter should not be incremented so template_created should not be changed."""
#TODO : factor with set_shift code
if
data
[
"is_makeup"
]:
shift_type
=
"standard"
if
data
[
'shift_type'
]
==
"ftop"
or
getattr
(
settings
,
'USE_STANDARD_SHIFT'
,
True
)
==
False
:
shift_type
=
"ftop"
if
(
shift_type
==
"standard"
and
data
[
'is_makeup'
]
is
not
True
)
or
shift_type
==
"ftop"
:
fieldsDatas
[
'template_created'
]
=
1
# It's not true but otherwise, presence add 1 standard point , which is not wanted
else
:
#the else does not exist in set_shift but is mandatory here as template_created value in reopened registration can be any value
fieldsDatas
[
"template_created"
]
=
False
fieldsDatas
[
"template_created"
]
=
False
response
=
self
.
o_api
.
update
(
'shift.registration'
,
[
shift_res
[
'id'
]],
fieldsDatas
)
response
=
self
.
o_api
.
update
(
'shift.registration'
,
[
shift_res
[
'id'
]],
fieldsDatas
)
except
Exception
as
e
:
except
Exception
as
e
:
coop_logger
.
error
(
"Reopen shift :
%
s"
,
str
(
e
))
coop_logger
.
error
(
"Reopen shift :
%
s"
,
str
(
e
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment