Commit a8b08028 authored by Ayush Tiwari's avatar Ayush Tiwari

CommitTool: No need to set Predecessor if its the premier commit

parent 3521f91f
...@@ -192,16 +192,18 @@ class CommitTool (BaseTool): ...@@ -192,16 +192,18 @@ class CommitTool (BaseTool):
commit_list = [l for l commit_list = [l for l
in self.objectValues(portal_type='Business Commit') in self.objectValues(portal_type='Business Commit')
if l != new_obj] if l != new_obj]
latest_commit = max(commit_list, key=(lambda x: x.getCreationDate()))
if commit_list:
if new_obj.getPortalType() == 'Business Commit': latest_commit = max(commit_list, key=(lambda x: x.getCreationDate()))
# TODO: Add check for no latest_commit. Usable especially for 1st BM
new_obj.setPredecessorValue(latest_commit) if new_obj.getPortalType() == 'Business Commit':
else: # TODO: Add check for no latest_commit. Usable especially for 1st BC
# If the new_obj is Business Snapshot, create a similar value for the new_obj.setPredecessorValue(latest_commit)
# latest commit else:
new_obj.setSimilarValue(latest_commit) # If the new_obj is Business Snapshot, create a similar value for the
latest_commit.setSimilarValue(new_obj) # latest commit
new_obj.setSimilarValue(latest_commit)
latest_commit.setSimilarValue(new_obj)
return new_obj return new_obj
......
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