Commit 53d10e8e authored by Vincent Pelletier's avatar Vincent Pelletier

CMFActivity: Factorise default group_method_cost value.

parent 4dd6848a
......@@ -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.
......
......@@ -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:]:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment