Commit a8b08028 authored by Ayush Tiwari's avatar Ayush Tiwari

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

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