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
Labels
Merge Requests
138
Merge Requests
138
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
53d10e8e
Commit
53d10e8e
authored
May 18, 2020
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CMFActivity: Factorise default group_method_cost value.
parent
4dd6848a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
product/CMFActivity/Activity/SQLBase.py
product/CMFActivity/Activity/SQLBase.py
+2
-2
product/CMFActivity/ActivityTool.py
product/CMFActivity/ActivityTool.py
+4
-0
No files found.
product/CMFActivity/Activity/SQLBase.py
View file @
53d10e8e
...
...
@@ -555,7 +555,7 @@ CREATE TABLE %s (
group_method_id
=
m
.
line
.
group_method_id
if
group_method_id
[
0
]
!=
'
\
0
'
:
# Count the number of objects to prevent too many objects.
cost
=
m
.
activity_kw
.
get
(
'group_method_cost'
,
.
01
)
cost
=
m
.
getGroupMethodCost
(
)
assert
0
<
cost
<=
1
,
(
self
.
sql_table
,
uid
)
count
=
m
.
getObjectCount
(
activity_tool
)
# this is heuristic (messages with same group_method_id
...
...
@@ -584,7 +584,7 @@ CREATE TABLE %s (
continue
uid_to_duplicate_uid_list_dict
[
uid
]
=
uid_list
cost
+=
m
.
getObjectCount
(
activity_tool
)
*
\
m
.
activity_kw
.
get
(
'group_method_cost'
,
.
01
)
m
.
getGroupMethodCost
(
)
message_list
.
append
(
m
)
if
cost
>=
1
:
# Unreserve extra messages as soon as possible.
...
...
product/CMFActivity/ActivityTool.py
View file @
53d10e8e
...
...
@@ -251,6 +251,10 @@ class Message(BaseMessage):
group_method_id
=
'portal_activities/dummyGroupMethod/'
+
self
.
method_id
return
group_method_id
+
'
\
0
'
+
get
(
'group_id'
,
''
)
def
getGroupMethodCost
(
self
):
# Meaningless if called on a non-grouped message
return
self
.
activity_kw
.
get
(
'group_method_cost'
,
.
01
)
def
_getObject
(
self
,
activity_tool
):
obj
=
activity_tool
.
getPhysicalRoot
()
for
id
in
self
.
object_path
[
1
:]:
...
...
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