Fix SQLAlchemy error by using ids not mapped instances v2

This commit is contained in:
rubenwardy 2024-07-04 22:02:23 +01:00
parent 6a64f3f24d
commit 542e51e733

@ -88,7 +88,7 @@ def add_notification(target, causer: User, type: NotificationType, title: str, u
if target.rank.at_least(UserRank.NEW_MEMBER) and target != causer:
session.query(Notification) \
.filter_by(user_id=target.id, causer_id=causer.id, type=type, title=title, url=url, package_id=package.id) \
.filter_by(user_id=target.id, causer_id=causer.id, type=type, title=title, url=url, package=package) \
.delete()
notif = Notification(target, causer, type, title, url, package)
session.add(notif)