Skip to content

Commit

Permalink
add new should_udpate func [SDCP-742] (#1963)
Browse files Browse the repository at this point in the history
* add new should_udpate func [SDCP-742]

* update params

* refactore logic
  • Loading branch information
devketanpro authored Apr 17, 2024
1 parent a978d10 commit e99b74c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions server/planning/events/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,15 @@ def delete_event_files(self, updates, original):
if events_using_file.count() == 0:
files_service.delete_action(lookup={"_id": file})

def should_update(self, old_item, new_item, provider):
return old_item is None or not any(
[
old_item.get("version_creator"),
old_item.get("pubstatus") == "cancelled",
old_item.get("state") == "killed",
]
)


class EventsResource(superdesk.Resource):
"""Resource for events data model
Expand Down
3 changes: 3 additions & 0 deletions server/planning/planning/planning.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,9 @@ def on_duplicated(self, doc, parent_id):
def on_locked_planning(self, item, user_id):
self.generate_related_assignments([item])

def should_update(self, old_item, new_item, provider):
return True

@staticmethod
def set_ingest_provider_sequence(item, provider):
"""Sets the value of ingest_provider_sequence in item.
Expand Down

0 comments on commit e99b74c

Please sign in to comment.