Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DESENG-437: Resolved a timezone discrepancy while publishing #2349

Merged
merged 6 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading