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
dd86a31c
Commit
dd86a31c
authored
Jan 13, 2025
by
Yvon Kerdoncuff
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minimal refactoring + comments
parent
8d05ac97
Pipeline
#4049
failed with stage
in 0 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
admin.py
members/admin.py
+4
-2
No files found.
members/admin.py
View file @
dd86a31c
...
...
@@ -394,7 +394,7 @@ def update_members_makeups(request):
if
is_connected_user
is
True
:
members_data
=
json
.
loads
(
request
.
body
.
decode
())
#
Make sure update would not unsubscribe member
#
Perform checks and compute some data in a loop on members.
cs
=
CagetteShift
()
unsubscription_limit
=
api
.
get_system_param
(
'lacagette_membership.points_limit_to_get_unsubscribed'
)
for
member_data
in
members_data
:
...
...
@@ -408,14 +408,16 @@ def update_members_makeups(request):
error
[
"error"
]
=
"L'opération de rattrapage a été annulée car le nombre de rattrapage cible est négatif."
return
JsonResponse
(
error
,
status
=
400
)
makeup_change_count
=
target_makeups_nb
-
cs
.
get_member_makeups_to_do
(
cm
.
id
)
members_data
[
member_data
[
"member_id"
]][
"points_diff"
]
=
-
makeup_change_count
points_target
=
cm
.
get_member_points
(
"standard"
)
-
makeup_change_count
if
points_target
<=
unsubscription_limit
:
error
=
[]
error
[
"error"
]
\
=
"L'ajout de rattrapage a été annulé car il provoquerait la désinscription d'un membre."
return
JsonResponse
(
error
,
status
=
400
)
# Save computed data in member_data. It will be useful to update makeups and points.
members_data
[
member_data
[
"member_id"
]][
"points_diff"
]
=
-
makeup_change_count
# Update makeups and points
res
[
"res"
]
=
[]
update_members_makeups_core
(
members_data
,
res
)
response
=
JsonResponse
(
res
)
...
...
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