add role mechanism for participants
This commit is contained in:
parent
0ec6996550
commit
e78e2f1989
@ -99,10 +99,17 @@ def airtable_dashboard():
|
|||||||
@auth_required()
|
@auth_required()
|
||||||
def display_participants():
|
def display_participants():
|
||||||
participants = fetch_api('participants')
|
participants = fetch_api('participants')
|
||||||
print("Participants: " + str(participants))
|
intervenants = fetch_api('intervenants')
|
||||||
|
|
||||||
records = []
|
records = []
|
||||||
for participant in participants.get_all():
|
if current_user.has_role("gestionnaire"):
|
||||||
records.append(participant)
|
for participant in participants.get_all():
|
||||||
|
records.append(participant)
|
||||||
|
elif current_user.has_role("prof"):
|
||||||
|
for participant in participants.get_all():
|
||||||
|
mes_intervenants = [ intervenants.get(intervenant_id)['fields'].get('email') for intervenant_id in (participant['fields'].get('Intervenants') or [])]
|
||||||
|
if current_user.email in mes_intervenants:
|
||||||
|
records.append(participant)
|
||||||
return render_template('participants/participants_list.html', records=records)
|
return render_template('participants/participants_list.html', records=records)
|
||||||
|
|
||||||
@airtable_bp.route("/participants/<participant_id>/dashboard", methods=['GET'])
|
@airtable_bp.route("/participants/<participant_id>/dashboard", methods=['GET'])
|
||||||
@ -346,9 +353,7 @@ def presences_workshop(module_id, workshop_id):
|
|||||||
participants_prevus = [ participants.get(participant) for participant in workshop['fields']['Participants prévus']]
|
participants_prevus = [ participants.get(participant) for participant in workshop['fields']['Participants prévus']]
|
||||||
participants_presents = [ participants.get(participant) for participant in workshop['fields']['Participants présents']]
|
participants_presents = [ participants.get(participant) for participant in workshop['fields']['Participants présents']]
|
||||||
participants_presents_ids = [ participant['id'] for participant in participants_presents ]
|
participants_presents_ids = [ participant['id'] for participant in participants_presents ]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
participants_presents_ids = request.form['presentParticipants'].split(',')
|
participants_presents_ids = request.form['presentParticipants'].split(',')
|
||||||
workshops.update(workshop['id'], {"Participants présents": participants_presents_ids})
|
workshops.update(workshop['id'], {"Participants présents": participants_presents_ids})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user