-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
Description
PR #6166 is wrong. The query fails in every case
open-event-server/app/api/helpers/scheduled_jobs.py
Lines 164 to 174 in bc45c1d
| def event_invoices_mark_due(): | |
| from app import current_app as app | |
| with app.app_context(): | |
| db.session.query(EventInvoice).\ | |
| filter(EventInvoice.status == 'upcoming', | |
| EventInvoice.event.ends_at >= datetime.datetime.now(), | |
| (EventInvoice.created_at + datetime.timedelta(days=30) <= | |
| datetime.datetime.now())).\ | |
| update({'status': 'due'}) | |
| db.session.commit() |
This line is not valid SQLAlchemy syntax:
| EventInvoice.event.ends_at >= datetime.datetime.now(), |
Neither 'InstrumentedAttribute' object nor 'Comparator' object associated with EventInvoice.event has an attribute 'ends_at'
It should be db.session.query(EventInvoice).join(Event).filter(EventInvoice.status == 'upcoming', Event.ends_at >= datetime.datetime.now()).all()
Each run of this task is failing
Fix it and write tests to ensure it is working