def registerattendee(groupId): if not groupId is None: group = Groups.get_or_none((Groups.group_id == groupId)) if group is None: # group-id not in database -> abort abort(404) else: event = Event.get_or_none(Event.event_id == group.event_id) if event is None: # event_id in group is not registered abort(500) else: instance = Instance.get_or_none( Instance.name == event.instance_id) if instance is None: abort(500) else: abort(400) # PLSS WHY DIDN'T I CHOOSE A JOIN registersuccess = request.args.get('registersuccess') if registersuccess is None: registersuccess = False username = request.args.get('username') return dict(group=group, event=event, instance=instance, registersuccess=registersuccess, username=username)
def admin(event_id: int): e: Event = Event.get_or_none(event_id) if e is None: abort(404) try: i: Instance = Instance.get(Instance.name == e.instance) api = RdyApi(i.hostname, i.api_key) groups = list(Groups.select().where( Groups.event_id == event_id).namedtuples()) except json.decoder.JSONDecodeError: abort(500, 'API Key invalid!') except DoesNotExist: abort(500, 'Instance does not Exist!') return dict(name=e.name, event_id=e.event_id, instance=i.name, instance_host=i.hostname, groups=groups)