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
c1ebf735
Commit
c1ebf735
authored
Nov 23, 2021
by
Damien Moulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
display comittees shifts in shifts history
parent
e0e7021d
Pipeline
#1529
passed with stage
in 1 minute 30 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
4 deletions
+47
-4
models.py
members_space/models.py
+37
-2
members-space-my-shifts.js
members_space/static/js/members-space-my-shifts.js
+10
-2
No files found.
members_space/models.py
View file @
c1ebf735
...
...
@@ -27,7 +27,7 @@ class CagetteMembersSpace(models.Model):
[
'state'
,
'!='
,
'replaced'
],
[
'state'
,
'!='
,
'replacing'
],
]
f
=
[
'
create_date
'
,
'shift_id'
,
'name'
,
'state'
,
'is_late'
,
'is_makeup'
]
f
=
[
'
date_begin
'
,
'shift_id'
,
'name'
,
'state'
,
'is_late'
,
'is_makeup'
]
marshal_none_error
=
'cannot marshal None unless allow_none is enabled'
try
:
...
...
@@ -36,10 +36,45 @@ class CagetteMembersSpace(models.Model):
except
Exception
as
e
:
if
not
(
marshal_none_error
in
str
(
e
)):
res
[
'error'
]
=
repr
(
e
)
coop_logger
.
error
(
res
[
'error'
]
+
' :
%
s'
,
str
(
pa
yment
_id
))
coop_logger
.
error
(
res
[
'error'
]
+
' :
%
s'
,
str
(
pa
rtner
_id
))
else
:
res
=
[]
# Get committees shifts
committees_shifts_name
=
getattr
(
settings
,
'ENTRANCE_ADD_PT_EVENT_NAME'
,
'Validation service comité'
)
cond
=
[
[
'partner_id'
,
'='
,
partner_id
],
[
'name'
,
'='
,
committees_shifts_name
]
]
f
=
[
'create_date'
]
try
:
# Don't bother having a global pagination, use the same
res_committees_shifts
=
self
.
o_api
.
search_read
(
'shift.counter.event'
,
cond
,
f
,
limit
=
limit
,
offset
=
offset
,
order
=
'create_date DESC'
)
for
committee_shift
in
res_committees_shifts
:
item
=
{
"date_begin"
:
committee_shift
[
"create_date"
],
"shift_id"
:
False
,
"name"
:
"Services des comités"
,
"state"
:
"done"
,
"is_late"
:
False
,
"is_makeup"
:
False
,
}
for
index
,
res_item
in
enumerate
(
res
):
if
(
res_item
[
"date_begin"
]
<
item
[
"date_begin"
]):
res
.
insert
(
index
,
item
)
break
except
Exception
as
e
:
if
not
(
marshal_none_error
in
str
(
e
)):
res
[
'error'
]
=
repr
(
e
)
coop_logger
.
error
(
res
[
'error'
]
+
' :
%
s'
,
str
(
partner_id
))
else
:
res
=
res
+
[]
except
Exception
as
e
:
print
(
str
(
e
))
...
...
members_space/static/js/members-space-my-shifts.js
View file @
c1ebf735
...
...
@@ -48,6 +48,16 @@ function prepare_server_data(data) {
res
=
[];
for
(
history_item
of
data
)
{
history_item
.
shift_name
=
(
history_item
.
shift_id
===
false
)
?
''
:
history_item
.
shift_id
[
1
];
if
(
history_item
.
name
===
"Services des comités"
)
{
let
shift_datetime
=
new
Date
(
history_item
.
date_begin
);
let
str_shift_datetime
=
`
${(
"0"
+
shift_datetime
.
getDate
()).
slice
(
-
2
)}
/
${(
"0"
+
(
shift_datetime
.
getMonth
()
+
1
)).
slice
(
-
2
)}
/
${
shift_datetime
.
getFullYear
()}
`
str_shift_datetime
=
str_shift_datetime
+
" "
+
shift_datetime
.
toLocaleTimeString
(
"fr-fr"
,
time_options
);
history_item
.
shift_name
=
`Services des comités
${
str_shift_datetime
}
`
}
history_item
.
details
=
''
;
if
(
history_item
.
state
===
'excused'
||
history_item
.
state
===
'absent'
)
{
history_item
.
details
=
"Absent"
;
...
...
@@ -58,8 +68,6 @@ function prepare_server_data(data) {
}
else
if
(
history_item
.
state
===
'cancel'
)
{
history_item
.
details
=
"Annulé"
;
}
history_item
.
shift_name
=
(
history_item
.
shift_id
===
false
)
?
''
:
history_item
.
shift_id
[
1
];
}
return
data
;
...
...
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