Skip to content

Commit

Permalink
Attendance check-in updates
Browse files Browse the repository at this point in the history
  • Loading branch information
avishkar58 committed Aug 30, 2024
1 parent 826b7b7 commit 145e16c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 19 deletions.
28 changes: 14 additions & 14 deletions api/app/attendance/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,28 +103,28 @@ def get(self):
invitedguest_role = invited_guest.role
confirmed = True
else:
registration = registration_response_repository.get_by_user_id(user.id, event_id)
confirmed = registration.confirmed if registration is not None else True
offer = offer_repository.get_by_user_id_for_event(user.id, event_id)
confirmed = offer.is_paid
invitedguest_role = "General Attendee"
is_invited_guest = False

# collate all tags belonging to user
# first, get all tags from registration questions
registration_metadata = []
questions_with_tags = registration_form_repository.get_registration_questions_with_tags(event_id)
for question in questions_with_tags:
for question_tag in question.tags:
answer = _get_registration_answer(user_id, event_id, question.id, is_invited_guest)
registration_metadata.append({"name": question_tag.tag.stringify_tag_name(), "response": answer})
print(registration_metadata)
# questions_with_tags = registration_form_repository.get_registration_questions_with_tags(event_id)
# for question in questions_with_tags:
# for question_tag in question.tags:
# answer = _get_registration_answer(user_id, event_id, question.id, is_invited_guest)
# registration_metadata.append({"name": question_tag.tag.stringify_tag_name(), "response": answer})
# print(registration_metadata)

# second, get all tags from offers
offer_metadata = []
offer = offer_repository.get_by_user_id_for_event(user_id, event_id)
if offer:
for offer_tag in offer.offer_tags:
offer_metadata.append({"name": offer_tag.tag.stringify_tag_name()})
print(offer_metadata)
# offer = offer_repository.get_by_user_id_for_event(user_id, event_id)
# if offer:
# for offer_tag in offer.offer_tags:
# offer_metadata.append({"name": offer_tag.tag.stringify_tag_name()})
# print(offer_metadata)

attendance_user = AttendanceUser(user, attendance, is_invitedguest=is_invited_guest,
invitedguest_role=invitedguest_role,
Expand Down Expand Up @@ -296,7 +296,7 @@ def get(self):

if exclude_already_checked_in:
checked_in = attendance_repository.get_confirmed_attendees(event_id)
checked_in = [u.user_id for u in checked_in]
checked_in = set(u.user_id for u in checked_in)
# TODO(avishkar): Check that this scales (n^2) appropriately.
all_attendees = [u for u in all_attendees if u.id not in checked_in]

Expand Down
14 changes: 9 additions & 5 deletions webapp/src/pages/attendance/components/AttendanceTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ class AttendanceTable extends React.Component {
}

onCheckin = user => {
console.log("On checkin, user is: ");
console.log(user);
const { eventId } = this.state;
attendanceService.checkIn(eventId, user.id).then(result => {
this.setState({
Expand Down Expand Up @@ -263,16 +261,22 @@ class AttendanceTable extends React.Component {
<h3>
{selectedUser.fullname}
</h3>
{/* // TODO: Check */}

{!selectedUser.confirmed && <div className="alert alert-danger">
!Payment Required! Please refer to special situations desk.
UNPAID FEES - Please refer to special situations desk.
</div>}
<h5>
Role:
<div className={this.styleFromRole(selectedUser.invitedguest_role)}>
{selectedUser.invitedguest_role}
</div>
</h5>
</h5>
{selectedUser.invitedguest_role === "Africa Research Day Attendee" && <h5 className="text-danger">
Can only check-in on Wednesday or Thursday
</h5>}
{selectedUser.invitedguest_role === "Workshop Speaker" && <h5 className="text-danger">
Can only check-in on Friday or Saturday
</h5>}
{selectedUser.registration_metadata.map((i) => ( // TODO: Replace with tags!
<h5>
{i.name} :
Expand Down

0 comments on commit 145e16c

Please sign in to comment.