refactor to make way for dockerization
This commit is contained in:
11
app/create_events.py
Normal file
11
app/create_events.py
Normal file
@@ -0,0 +1,11 @@
|
||||
def createEvents(db, currDay, Period, Event):
|
||||
periods = Period.query.all()
|
||||
for period in periods:
|
||||
q = db.session.query(Event).filter(Event.scheduled_date == currDay).filter(Event.period_num == period.period)
|
||||
isEventsExist = db.session.query(q.exists()).scalar()
|
||||
if isEventsExist == False:
|
||||
event = Event(scheduled_date=currDay,
|
||||
period_num=period.period
|
||||
)
|
||||
db.session.add(event)
|
||||
db.session.commit()
|
Reference in New Issue
Block a user