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
225b0401
Commit
225b0401
authored
Nov 17, 2021
by
Damien Moulard
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ticket_1682' into 'evolution_bdm'
Ticket 1682 See merge request
!58
parents
e2227909
fc8a47ca
Pipeline
#1452
passed with stage
in 1 minute 33 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
2 deletions
+16
-2
models.py
shifts/models.py
+10
-0
views.py
shifts/views.py
+6
-2
No files found.
shifts/models.py
View file @
225b0401
...
...
@@ -89,6 +89,15 @@ class CagetteShift(models.Model):
shiftData
=
self
.
o_api
.
search_read
(
'shift.registration'
,
cond
,
fields
,
order
=
"date_begin ASC"
)
return
shiftData
def
shift_is_makeup
(
self
,
id
):
"""vérifie si une shift est un rattrapage"""
fields
=
[
"is_makeup"
,
"id"
]
cond
=
[[
'id'
,
'='
,
id
]]
shiftData
=
self
.
o_api
.
search_read
(
'shift.registration'
,
cond
,
fields
)
return
shiftData
[
0
][
"is_makeup"
]
def
get_shift_calendar
(
self
,
id
,
start
,
end
):
"""Récupère les shifts à partir de maintenant pour le calendier"""
cond
=
[[
'date_begin'
,
'>'
,
datetime
.
datetime
.
now
()
.
isoformat
()],
...
...
@@ -144,6 +153,7 @@ class CagetteShift(models.Model):
"shift_ticket_id"
:
self
.
get_shift_ticket
(
data
[
'idShift'
],
data
[
'in_ftop_team'
]),
"shift_type"
:
shift_type
,
"origin"
:
'memberspace'
,
"is_makeup"
:
data
[
'is_makeup'
],
"state"
:
'open'
}
st_r_id
=
self
.
o_api
.
create
(
'shift.registration'
,
fieldsDatas
)
...
...
shifts/views.py
View file @
225b0401
...
...
@@ -178,12 +178,15 @@ def change_shift(request):
if
'idNewShift'
in
request
.
POST
and
'idOldShift'
in
request
.
POST
:
idOldShift
=
request
.
POST
[
'idOldShift'
]
listRegister
=
[
int
(
request
.
POST
[
'idRegister'
])]
data
=
{
"idPartner"
:
int
(
request
.
POST
[
'idPartner'
]),
"idShift"
:
int
(
request
.
POST
[
'idNewShift'
]),
"in_ftop_team"
:
request
.
POST
[
'in_ftop_team'
]
"in_ftop_team"
:
request
.
POST
[
'in_ftop_team'
],
"is_makeup"
:
cs
.
shift_is_makeup
(
listRegister
)
}
should_block_service_exchange
=
getattr
(
settings
,
'BLOCK_SERVICE_EXCHANGE_24H_BEFORE'
,
False
)
if
should_block_service_exchange
:
# Block change if old shift is to happen in less than 24 hours
...
...
@@ -228,7 +231,8 @@ def add_shift(request):
data
=
{
"idPartner"
:
int
(
request
.
POST
[
'idPartner'
]),
"idShift"
:
int
(
request
.
POST
[
'idNewShift'
]),
"in_ftop_team"
:
request
.
POST
[
'in_ftop_team'
]
"in_ftop_team"
:
request
.
POST
[
'in_ftop_team'
],
"is_makeup"
:
True
}
#Insertion du nouveau shift
...
...
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