Skip to content

Commit

Permalink
DESENG-437: Resolved a timezone discrepancy while publishing (#2349)
Browse files Browse the repository at this point in the history
* 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

* DESENG-437: Fixed CHANGELOG conflicts

* Updating the changelog

* Fixing SQLALCHEMY_DATABASE_URI error
  • Loading branch information
ratheesh-aot authored and NatSquared committed Jan 19, 2024
1 parent d6dd304 commit ccc1061
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
14 changes: 6 additions & 8 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
# Change Log

All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/).

## 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)
Expand All @@ -15,6 +7,12 @@ All notable changes to this project will be documented in this file. This projec
- 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)
Expand Down
4 changes: 2 additions & 2 deletions met-api/src/met_api/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions met-api/src/met_api/models/engagement.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
5 changes: 5 additions & 0 deletions met-api/src/met_api/services/engagement_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,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,
Expand Down

0 comments on commit ccc1061

Please sign in to comment.