Skip to content

Commit

Permalink
allow ingestion of cancelled events (#2009)
Browse files Browse the repository at this point in the history
we have some events which already expired but then
they get cancelled but those get ingested with usable pubstatus

SDCP-792
  • Loading branch information
petrjasek authored Jul 2, 2024
1 parent a3111ba commit 307aefa
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
1 change: 0 additions & 1 deletion server/planning/commands/export_to_newsroom.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ def run(self, resource_url, assets_url, size=None):
logger.info("Completed export events and planning.")

def _fetch_items(self, fetch_callback):
""""""
query = {
"query": {
"bool": {
Expand Down
1 change: 0 additions & 1 deletion server/planning/events/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ def post_in_mongo(self, docs, **kwargs):

for doc in docs:
self._resolve_defaults(doc)
doc.pop("pubstatus", None)
set_ingest_version_datetime(doc)

self.on_create(docs)
Expand Down
21 changes: 21 additions & 0 deletions server/planning/events/events_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,27 @@ def test_get_recurring_timeline(self):
self.assertEquals(e["dates"]["start"], expected_time)
expected_time += timedelta(days=1)

def test_create_cancelled_event(self):
with self.app.app_context():
service = get_resource_service("events")
service.post_in_mongo(
[
{
"guid": "test",
"name": "Test Event",
"pubstatus": "cancelled",
"dates": {
"start": datetime.now(),
"end": datetime.now() + timedelta(days=1),
},
}
]
)

event = service.find_one(req=None, guid="test")
assert event is not None
assert event["pubstatus"] == "cancelled"


class EventLocationFormatAddress(TestCase):
def test_format_address(self):
Expand Down

0 comments on commit 307aefa

Please sign in to comment.