mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-20 15:31:15 -05:00
The update of SQLAlchemy 1.4.10 has caused some conflicts in our code. This PR fixes most of those conflicts.
- sqlalchemy.sql.expression.case must include an else statement. - clearly define list of columns for inbound_sms_history insert, getting the list from InboundSmsHistory.__table__.c was causing data type errors. - remove relationships when not needed, the foreign key relationship is established in the creation of the column. This will get rid of the warnings referenced here: http://sqlalche.me/e/14/qzyx. - update queries now that he user relationship in ServiceUser db model has been removed. - move the check that a template is archived to the view instead of the dao method. The check was clearing the session before the version history could be done. Deleting notifications in the night tasks still needs to be investigated. The raw sql is causing an error.
This commit is contained in:
@@ -150,9 +150,12 @@ def fetch_letter_line_items_for_all_services(start_date, end_date):
|
||||
[(FactBilling.postage.in_(INTERNATIONAL_POSTAGE_TYPES), "international")], else_=FactBilling.postage
|
||||
).label("postage")
|
||||
|
||||
postage_order = case(((formatted_postage == "second", 1),
|
||||
(formatted_postage == "first", 2),
|
||||
(formatted_postage == "international", 3)))
|
||||
postage_order = case(
|
||||
(formatted_postage == "second", 1),
|
||||
(formatted_postage == "first", 2),
|
||||
(formatted_postage == "international", 3),
|
||||
else_=0 # assumes never get 0 as a result
|
||||
)
|
||||
|
||||
query = db.session.query(
|
||||
Organisation.name.label("organisation_name"),
|
||||
|
||||
Reference in New Issue
Block a user