Link to member pages in the Instructor Attendance panel

This commit is contained in:
Tanner Collin 2020-10-05 21:07:08 +00:00
parent de68fd79b7
commit d5b8ffa0e2
2 changed files with 11 additions and 1 deletions

View File

@ -340,6 +340,7 @@ class TrainingSerializer(serializers.ModelSerializer):
session = serializers.PrimaryKeyRelatedField(queryset=models.Session.objects.all())
student_name = serializers.SerializerMethodField()
student_email = serializers.SerializerMethodField()
student_id = serializers.SerializerMethodField()
class Meta:
model = models.Training
@ -360,6 +361,12 @@ class TrainingSerializer(serializers.ModelSerializer):
member = models.Member.objects.get(id=obj.member_id)
return member.old_email
def get_student_id(self, obj):
if obj.user:
return obj.user.member.id
else:
return obj.member_id
class StudentTrainingSerializer(TrainingSerializer):
attendance_status = serializers.ChoiceField(['Waiting for payment', 'Withdrawn'])

View File

@ -99,7 +99,10 @@ function AttendanceRow(props) {
return (
<div className='attendance-row'>
<p>{student.student_name}{student.attendance_status === 'Waiting for payment' && ' (Waiting for payment)'}:</p>
<p>
<Link to={'/members/'+student.student_id}>{student.student_name}</Link>
{student.attendance_status === 'Waiting for payment' && ' (Waiting for payment)'}:
</p>
<Button {...makeProps('Withdrawn')}>
Withdrawn