From d280d7c9767140efca0861b675298a6e4f7791b6 Mon Sep 17 00:00:00 2001 From: Ratheesh kumar R Date: Tue, 9 Jan 2024 11:14:40 -0800 Subject: [PATCH 1/4] DESENG-437: Fixing Publish engagement timezone and error message Removed the title and caption of the change log file as it is not relevant anymore --- CHANGELOG.MD | 4 ++-- met-api/src/met_api/models/engagement.py | 4 ++-- met-api/src/met_api/services/engagement_service.py | 5 +++++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.MD b/CHANGELOG.MD index 92aa8784f..248f6c68a 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -1,6 +1,6 @@ -# Change Log +## January 09, 2024 -All notable changes to this project will be documented in this file. +- **Bug Fix**: Fixing timezone issue while publishing using met coron [🎟️DESENG-437](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-437) ## December 11, 2023 diff --git a/met-api/src/met_api/models/engagement.py b/met-api/src/met_api/models/engagement.py index 487120ab8..ff025dff6 100644 --- a/met-api/src/met_api/models/engagement.py +++ b/met-api/src/met_api/models/engagement.py @@ -172,8 +172,8 @@ def close_engagements_due(cls) -> List[Engagement]: @classmethod def publish_scheduled_engagements_due(cls) -> List[Engagement]: """Update scheduled engagements to published.""" - datetime_due = datetime.now() - print('Publish due date ------------------------', datetime_due) + datetime_due = datetime.utcnow() + print('Publish due date (UTC) ------------------------', datetime_due) update_fields = dict( status_id=Status.Published.value, published_date=datetime.utcnow(), diff --git a/met-api/src/met_api/services/engagement_service.py b/met-api/src/met_api/services/engagement_service.py index 7f1ef3d6a..3a2ddbc26 100644 --- a/met-api/src/met_api/services/engagement_service.py +++ b/met-api/src/met_api/services/engagement_service.py @@ -136,6 +136,11 @@ def close_engagements_due(): def publish_scheduled_engagements(): """Publish scheduled engagement due.""" engagements = EngagementModel.publish_scheduled_engagements_due() + + if not engagements: + print('There are no engagements scheduled for publication') + return None + print('Engagements published: ', engagements) for engagement in engagements: email_util.publish_to_email_queue(SourceType.ENGAGEMENT.value, engagement.id, From 7bde1a8245ca338662b4922bcb03dbeb50b30043 Mon Sep 17 00:00:00 2001 From: Ratheesh kumar R Date: Tue, 9 Jan 2024 11:28:29 -0800 Subject: [PATCH 2/4] DESENG-437: Fixed CHANGELOG conflicts --- CHANGELOG.MD | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/CHANGELOG.MD b/CHANGELOG.MD index a2363669b..613b53274 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -1,14 +1,10 @@ ## January 09, 2024 -<<<<<<< HEAD -- **Bug Fix**: Fixing timezone issue while publishing using met coron [🎟️DESENG-437](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-437) -======= -All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/). +- **Bug Fix**: Fixing timezone issue while publishing using met cron [🎟️DESENG-437](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-437) ## December 28, 2023 > **Feature**: Added the timeline widget. [🎟️DESENG-439](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-439) ->>>>>>> upstream/main ## December 11, 2023 From f5e86c990bbaa6cb7d04024eb73d4ff1089e38ed Mon Sep 17 00:00:00 2001 From: Ratheesh kumar R Date: Wed, 10 Jan 2024 11:33:07 -0800 Subject: [PATCH 3/4] Updating the changelog --- CHANGELOG.MD | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.MD b/CHANGELOG.MD index 605625f1a..031964adc 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -1,11 +1,3 @@ -## January 09, 2024 - -- **Bug Fix**: Fixing timezone issue while publishing using met cron [🎟️DESENG-437](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-437) - -## December 28, 2023 - -> **Feature**: Added the timeline widget. [🎟️DESENG-439](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-439) - ## January 9, 2024 - **Task** Improvements from Epic [🎟️DESENG-468](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-468) @@ -15,6 +7,12 @@ - Formio Version Update - Enable Survey Editing for Open Engagements +- **Bug Fix**: Fixing timezone issue while publishing using met cron [🎟️DESENG-437](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-437) + +## December 28, 2023 + +> **Feature**: Added the timeline widget. [🎟️DESENG-439](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-439) + ## December 11, 2023 - **Task** Merge `gdx-sso`, `gdx-dev`, `gdx-main` into `main` [🎟️DESENG-442](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-442) From 9d8e6b5923af50f2f0e9b36507c3e8678a027e7e Mon Sep 17 00:00:00 2001 From: Ratheesh kumar R Date: Wed, 10 Jan 2024 12:05:05 -0800 Subject: [PATCH 4/4] Fixing SQLALCHEMY_DATABASE_URI error --- met-api/src/met_api/config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/met-api/src/met_api/config.py b/met-api/src/met_api/config.py index 9b0b76216..48959c202 100644 --- a/met-api/src/met_api/config.py +++ b/met-api/src/met_api/config.py @@ -86,7 +86,7 @@ def __init__(self) -> None: in the normal class definition. """ # If extending this class, call super().__init__() in your constructor. - print(f'SQLAlchemy URL: {self.sqlalchemy_database_uri}') + print(f'SQLAlchemy URL: {self.SQLALCHEMY_DATABASE_URI}') # apply configs to _Config in the format that flask_jwt_oidc expects # this flattens the JWT_CONFIG dict into individual attributes @@ -97,7 +97,7 @@ def __init__(self) -> None: os.environ['FLASK_DEBUG'] = str(self.USE_DEBUG) @property - def sqlalchemy_database_uri(self) -> str: + def SQLALCHEMY_DATABASE_URI(self) -> str: """ Dynamically fetch the SQLAlchemy Database URI based on the DB config.