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
bacaa1e4
Commit
bacaa1e4
authored
Nov 23, 2021
by
Damien Moulard
Browse files
Options
Browse Files
Download
Plain Diff
merge deleted branch in origin
parents
0ccb258d
8c96561a
Pipeline
#1542
passed with stage
in 1 minute 31 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
51 additions
and
42 deletions
+51
-42
config_lacagette.py
coops_configurations/config_lacagette.py
+1
-1
models.py
members_space/models.py
+32
-16
members-space-my-shifts.css
members_space/static/css/members-space-my-shifts.css
+4
-6
members-space-my-shifts.js
members_space/static/js/members-space-my-shifts.js
+13
-7
views.py
members_space/views.py
+0
-11
config.md
outils/config.md
+1
-1
No files found.
coops_configurations/config_lacagette.py
View file @
bacaa1e4
...
...
@@ -125,7 +125,7 @@ RECEPTION_PB = "Ici, vous pouvez signaler toute anomalie lors d'une réception,
Merci d'indiquer un maximum d'informations, le nom du produit et son code barre.
\
Dans le cas de produits déteriorés, merci d'envoyer une photo avec votre téléphone à [Adresse_email]"
AMNISTIE_DATE
=
"2021-11-24"
AMNISTIE_DATE
=
"2021-11-24
00:00:00
"
# display or not column "Autres" in reception process
DISPLAY_COL_AUTRES
=
False
...
...
members_space/models.py
View file @
bacaa1e4
...
...
@@ -13,7 +13,8 @@ class CagetteMembersSpace(models.Model):
def
get_shifts_history
(
self
,
partner_id
,
limit
,
offset
,
date_from
):
""" Get partner shifts history """
res
=
{}
res
=
[]
paginated_res
=
[]
today
=
str
(
datetime
.
date
.
today
())
try
:
...
...
@@ -27,16 +28,15 @@ class CagetteMembersSpace(models.Model):
[
'state'
,
'!='
,
'replaced'
],
[
'state'
,
'!='
,
'replacing'
],
]
f
=
[
'date_begin'
,
'shift_id'
,
'name'
,
'state'
,
'is_late'
,
'is_makeup'
]
f
=
[
'
create_date'
,
'
date_begin'
,
'shift_id'
,
'name'
,
'state'
,
'is_late'
,
'is_makeup'
]
marshal_none_error
=
'cannot marshal None unless allow_none is enabled'
try
:
res
=
self
.
o_api
.
search_read
(
'shift.registration'
,
cond
,
f
,
limit
=
limit
,
offset
=
offset
,
order
=
'date_begin DESC'
)
res
=
self
.
o_api
.
search_read
(
'shift.registration'
,
cond
,
f
,
order
=
'date_begin DESC'
)
except
Exception
as
e
:
if
not
(
marshal_none_error
in
str
(
e
)):
res
[
'error'
]
=
repr
(
e
)
coop_logger
.
error
(
re
s
[
'error'
]
+
' :
%
s'
,
str
(
partner_id
))
print
(
str
(
e
)
)
coop_logger
.
error
(
re
pr
(
e
)
+
' :
%
s'
,
str
(
partner_id
))
else
:
res
=
[]
...
...
@@ -49,12 +49,11 @@ class CagetteMembersSpace(models.Model):
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'
)
res_committees_shifts
=
self
.
o_api
.
search_read
(
'shift.counter.event'
,
cond
,
f
,
order
=
'create_date DESC'
)
for
committee_shift
in
res_committees_shifts
:
item
=
{
"create_date"
:
committee_shift
[
"create_date"
],
"date_begin"
:
committee_shift
[
"create_date"
],
"shift_id"
:
False
,
"name"
:
"Services des comités"
,
...
...
@@ -63,20 +62,36 @@ class CagetteMembersSpace(models.Model):
"is_makeup"
:
False
,
}
for
index
,
res_item
in
enumerate
(
res
):
if
(
res_item
[
"date_begin"
]
<
item
[
"date_begin"
]):
res
.
insert
(
index
,
item
)
break
res
.
append
(
item
)
except
Exception
as
e
:
if
not
(
marshal_none_error
in
str
(
e
)):
res
[
'error'
]
=
repr
(
e
)
coop_logger
.
error
(
re
s
[
'error'
]
+
' :
%
s'
,
str
(
partner_id
))
print
(
str
(
e
)
)
coop_logger
.
error
(
re
pr
(
e
)
+
' :
%
s'
,
str
(
partner_id
))
else
:
res
=
res
+
[]
# Add amnesty line
is_amnesty
=
getattr
(
settings
,
'AMNISTIE_DATE'
,
'false'
)
company_code
=
getattr
(
settings
,
'COMPANY_CODE'
,
''
)
if
is_amnesty
and
company_code
==
"lacagette"
:
amnesty
=
{}
amnesty
[
'is_amnesty'
]
=
True
amnesty
[
'create_date'
]
=
is_amnesty
amnesty
[
'date_begin'
]
=
is_amnesty
amnesty
[
'shift_name'
]
=
'Amnistie'
amnesty
[
'state'
]
=
''
res
.
append
(
amnesty
)
# ordering
res
.
sort
(
key
=
lambda
x
:
datetime
.
datetime
.
strptime
(
x
[
'date_begin'
],
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
),
reverse
=
True
)
# Paginate
end_index
=
offset
+
limit
paginated_res
=
res
[
offset
:
end_index
]
except
Exception
as
e
:
print
(
str
(
e
))
return
res
return
paginated_
res
\ No newline at end of file
members_space/static/css/members-space-my-shifts.css
View file @
bacaa1e4
...
...
@@ -84,12 +84,9 @@ table.dataTable.display tbody tr.row_partner_absent {
background-color
:
#ff847b
;
}
table
.dataTable.display
tbody
tr
.row_partner_amnistie
{
background-color
:
black
;
background-color
:
rgb
(
78
,
78
,
78
)
;
color
:
white
;
}
table
.dataTable.display
tbody
tr
.row_partner_ok
td
,
table
.dataTable.display
tbody
tr
.row_partner_late
td
,
table
.dataTable.display
tbody
tr
.row_partner_absent
td
{
border-bottom
:
1px
solid
rgb
(
100
,
99
,
99
);
border-top
:
1px
solid
rgb
(
100
,
99
,
99
);
table
.dataTable.display
tbody
tr
td
{
border-top
:
1px
solid
rgb
(
119
,
119
,
119
);
}
\ No newline at end of file
members_space/static/js/members-space-my-shifts.js
View file @
bacaa1e4
...
...
@@ -48,14 +48,21 @@ 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"
)
{
if
(
history_item
.
is_amnesty
!==
undefined
)
{
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
.
shift_name
=
`
${
history_item
.
shift_name
}
du
${
str_shift_datetime
}
`
}
else
{
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
=
''
;
...
...
@@ -68,7 +75,6 @@ function prepare_server_data(data) {
}
else
if
(
history_item
.
state
===
'cancel'
)
{
history_item
.
details
=
"Annulé"
;
}
if
(
history_item
.
is_amnesty
==
undefined
)
history_item
.
shift_name
=
(
history_item
.
shift_id
===
false
)
?
''
:
history_item
.
shift_id
[
1
];
}
return
data
;
...
...
@@ -114,7 +120,7 @@ function init_history() {
$
(
row
).
addClass
(
'row_partner_late'
);
}
else
if
(
cell
.
text
()
===
"Absent.e"
)
{
$
(
row
).
addClass
(
'row_partner_absent'
);
}
else
if
(
cell
.
text
()
===
"Amnistie"
)
{
}
else
if
(
cell
.
text
()
.
includes
(
"Amnistie"
)
)
{
$
(
row
).
addClass
(
'row_partner_amnistie'
);
}
}
...
...
members_space/views.py
View file @
bacaa1e4
...
...
@@ -221,15 +221,5 @@ def get_shifts_history(request):
offset
=
int
(
request
.
GET
.
get
(
'offset'
))
date_from
=
getattr
(
settings
,
'START_DATE_FOR_SHIFTS_HISTORY'
,
'2018-01-01'
)
res
[
"data"
]
=
m
.
get_shifts_history
(
partner_id
,
limit
,
offset
,
date_from
)
is_amnesty
=
getattr
(
settings
,
'AMNISTIE_DATE'
,
'false'
)
company_code
=
getattr
(
settings
,
'COMPANY_CODE'
,
''
)
if
is_amnesty
and
company_code
==
"lacagette"
:
amnesty
=
{}
amnesty
[
'is_amnesty'
]
=
True
amnesty
[
'create_date'
]
=
is_amnesty
amnesty
[
'shift_name'
]
=
'Amnistie'
amnesty
[
'state'
]
=
''
res
[
"data"
]
.
append
(
amnesty
)
return
JsonResponse
(
res
)
\ No newline at end of file
outils/config.md
View file @
bacaa1e4
...
...
@@ -311,7 +311,7 @@
Message shown to people when they connect to the Member Space
-
AMNISTIE_DATE = "2021-11-24"
-
AMNISTIE_DATE = "2021-11-24
00:00:00
"
In members_space history display a special activity about amnistie
### Reception
...
...
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