|
@@ -15,23 +15,26 @@ db = SQLAlchemy(app)
|
|
|
|
|
|
def show_participants():
|
|
def show_participants():
|
|
for p in Participant.query.all():
|
|
for p in Participant.query.all():
|
|
- print("[{}] {} ({}) is {} "
|
|
|
|
- "and has UUID {}".format(p.id,
|
|
|
|
- p.name,
|
|
|
|
- p.contact,
|
|
|
|
- "active" if p.active else "inactive",
|
|
|
|
- p.uuid))
|
|
|
|
-
|
|
|
|
-def activate_participant(id):
|
|
|
|
|
|
+ print("[{}] {}, {} ({}) is {} "
|
|
|
|
+ "and has UUID {} ({})".format(p.id,
|
|
|
|
+ p.name,
|
|
|
|
+ p.country,
|
|
|
|
+ p.contact,
|
|
|
|
+ "active" if p.active else "inactive",
|
|
|
|
+ p.uuid,
|
|
|
|
+ p.comment))
|
|
|
|
+
|
|
|
|
+def toggle_participant(id):
|
|
p = Participant.query.get(id)
|
|
p = Participant.query.get(id)
|
|
- p.active = True
|
|
|
|
|
|
+ p.active = not p.active
|
|
db.session.merge(p)
|
|
db.session.merge(p)
|
|
db.session.commit()
|
|
db.session.commit()
|
|
- print("Activated participant {}".format(p))
|
|
|
|
|
|
+ print("{}ctivated participant {}".format("A" if p.active else "Dea",
|
|
|
|
+ p))
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
if __name__ == '__main__':
|
|
if len(sys.argv) > 1:
|
|
if len(sys.argv) > 1:
|
|
- activate_participant(int(sys.argv[1]))
|
|
|
|
|
|
+ toggle_participant(int(sys.argv[1]))
|
|
else:
|
|
else:
|
|
show_participants()
|
|
show_participants()
|