Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alecs_myu
erp5
Commits
7c3d482f
Commit
7c3d482f
authored
Sep 07, 2018
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
officejs_support_request_ui: simplify date arithmetics
parent
29795b08
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
9 deletions
+6
-9
bt5/erp5_officejs_support_request_ui/SkinTemplateItem/portal_skins/erp5_officejs_support_request/SupportRequest_getSupportRequestStatisticsAsJson.py
...quest/SupportRequest_getSupportRequestStatisticsAsJson.py
+6
-9
No files found.
bt5/erp5_officejs_support_request_ui/SkinTemplateItem/portal_skins/erp5_officejs_support_request/SupportRequest_getSupportRequestStatisticsAsJson.py
View file @
7c3d482f
from
datetime
import
timedelta
from
json
import
dumps
portal
=
context
.
getPortalObject
()
# Get the split date
now_date
=
DateTime
()
date_2
=
now_date
-
2
date_7
=
now_date
-
7
date_30
=
now_date
-
30
# we can not use str.join...
date_2_midnight
=
DateTime
(
str
(
date_2
.
year
())
+
"-"
+
str
(
date_2
.
month
())
+
"-"
+
str
(
date_2
.
day
()))
date_7_midnight
=
DateTime
(
str
(
date_7
.
year
())
+
"-"
+
str
(
date_7
.
month
())
+
"-"
+
str
(
date_7
.
day
()))
date_30_midnight
=
DateTime
(
str
(
date_30
.
year
())
+
"-"
+
str
(
date_30
.
month
())
+
"-"
+
str
(
date_30
.
day
()))
now_date
=
DateTime
().
asdatetime
()
date_2_midnight
=
DateTime
(
now_date
-
timedelta
(
days
=
2
)).
earliestTime
()
date_7_midnight
=
DateTime
(
now_date
-
timedelta
(
days
=
7
)).
earliestTime
()
date_30_midnight
=
DateTime
(
now_date
-
timedelta
(
days
=
30
)).
earliestTime
()
support_request_list
=
portal
.
portal_catalog
(
portal_type
=
"Support Request"
,
select_list
=
[
'simulation_state'
,
'start_date'
],
**
{
"delivery.start_date"
:
{
"query"
:
now_date
,
"range"
:
"ngt"
}}
**
{
"delivery.start_date"
:
{
"query"
:
DateTime
(
now_date
)
,
"range"
:
"ngt"
}}
)
count_by_state
=
{}
...
...
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