From e86250b41e12c86c7c1fdf48164123aaff9d25da Mon Sep 17 00:00:00 2001 From: Miklos Sarosi Date: Mon, 26 Oct 2020 20:50:50 +0000 Subject: [PATCH 1/3] Pull changes from upstream and update --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 0b3983f9..4e24bc0b 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,5 @@ env.py settings.json .gitpod.yml venv/ -.idea/ \ No newline at end of file +.idea/ +MYNOTES.md \ No newline at end of file From fc7c6bb71871404299f9c322dcbcad43112f4db2 Mon Sep 17 00:00:00 2001 From: Miklos Sarosi Date: Tue, 7 Dec 2021 20:21:16 +0000 Subject: [PATCH 2/3] Initial commit on bug-fix #253 branch --- hackadmin/helpers.py | 3 +++ hackadmin/views.py | 5 ++++- teams/views.py | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/hackadmin/helpers.py b/hackadmin/helpers.py index 87ab3c6b..90a544f7 100644 --- a/hackadmin/helpers.py +++ b/hackadmin/helpers.py @@ -17,6 +17,7 @@ def extract_badges_for_hackathon(hackathon, issue_date, format='json'): """ Extracts a list of badges to award to participants """ + print("\n\n\nextract_badges_for_hackathon helper function CALLED\n\n\n") badges = {} awards = hackathon.awards.order_by('hack_award_category__ranking') participants = [ @@ -63,6 +64,8 @@ def extract_badges_for_hackathon(hackathon, issue_date, format='json'): badges.setdefault('facilitators', []) for team in hackathon.teams.all(): + print("\n CRITICAL LINE RAN") + print(f"{team.mentor.first_name=}") badges['facilitators'].append({ 'first_name': team.mentor.first_name, 'name': team.mentor.full_name or team.mentor.slack_display_name, diff --git a/hackadmin/views.py b/hackadmin/views.py index 7f244dfa..4b50bd0d 100644 --- a/hackadmin/views.py +++ b/hackadmin/views.py @@ -38,21 +38,24 @@ def hackathon_participants(request, hackathon_id): by individual hackathon """ # TODO: Filter hackathons by user type, PARTNER_ADMIN should not have # access to all hackathons and users + print(" +++++++++++++++++++++++ \n"*3) slack_url = None hackathon = get_object_or_404(Hackathon, id=hackathon_id) mentors = [{ 'team': team, 'mentor': team.mentor } for team in hackathon.teams.all()] + print(f"{mentors=}\n") if settings.SLACK_ENABLED: slack_url = f'https://{settings.SLACK_WORKSPACE}.slack.com/team/' badges_csv = 'data:text/csv;charset=utf-8,' + extract_badges_for_hackathon( hackathon, date.today().isoformat(), format='csv') + print(f"\n\n{badges_csv=}\n") awardees = [awardee for category, values in extract_badges_for_hackathon( hackathon, date.today().isoformat()).items() for awardee in values if category not in ['participants', 'judges', 'facilitators']] - print(awardees) + print(f"{awardees=}") return render(request, 'hackadmin_participants.html', { 'hackathon': hackathon, 'mentors': mentors, diff --git a/teams/views.py b/teams/views.py index 86412fea..3a4c0c20 100644 --- a/teams/views.py +++ b/teams/views.py @@ -130,6 +130,7 @@ def view_team(request, team_id): create_group_im = (settings.SLACK_ENABLED and settings.SLACK_BOT_TOKEN) mentor_profile = None + print(f"\n\n{settings=}") if team.mentor and settings.SLACK_WORKSPACE: mentor_slack_id = team.mentor.username.split('_')[0] mentor_profile = (f'https://{settings.SLACK_WORKSPACE}.slack.com/' From e0470961aff2e8ca58548dc8eab3bafce9d92342 Mon Sep 17 00:00:00 2001 From: Miklos Sarosi Date: Wed, 8 Dec 2021 11:47:59 +0000 Subject: [PATCH 3/3] Fix Bug#253 --- hackadmin/helpers.py | 24 +++++++++++------------- hackadmin/views.py | 4 ---- teams/views.py | 1 - 3 files changed, 11 insertions(+), 18 deletions(-) diff --git a/hackadmin/helpers.py b/hackadmin/helpers.py index 90a544f7..996a2589 100644 --- a/hackadmin/helpers.py +++ b/hackadmin/helpers.py @@ -17,7 +17,6 @@ def extract_badges_for_hackathon(hackathon, issue_date, format='json'): """ Extracts a list of badges to award to participants """ - print("\n\n\nextract_badges_for_hackathon helper function CALLED\n\n\n") badges = {} awards = hackathon.awards.order_by('hack_award_category__ranking') participants = [ @@ -64,18 +63,17 @@ def extract_badges_for_hackathon(hackathon, issue_date, format='json'): badges.setdefault('facilitators', []) for team in hackathon.teams.all(): - print("\n CRITICAL LINE RAN") - print(f"{team.mentor.first_name=}") - badges['facilitators'].append({ - 'first_name': team.mentor.first_name, - 'name': team.mentor.full_name or team.mentor.slack_display_name, - 'email': team.mentor.email, - 'issue_date': issue_date, - 'team': team.display_name, - 'project': team.project.display_name if team.project else '', - 'award': 'Hackathon Facilitators', - 'award_ranking': 'n/a', - }) + if team.mentor: + badges['facilitators'].append({ + 'first_name': team.mentor.first_name, + 'name': team.mentor.full_name or team.mentor.slack_display_name, + 'email': team.mentor.email, + 'issue_date': issue_date, + 'team': team.display_name, + 'project': team.project.display_name if team.project else '', + 'award': 'Hackathon Facilitators', + 'award_ranking': 'n/a', + }) projects = [team.project for team in hackathon.teams.all() if team.project] diff --git a/hackadmin/views.py b/hackadmin/views.py index 4b50bd0d..2e2ab99f 100644 --- a/hackadmin/views.py +++ b/hackadmin/views.py @@ -38,24 +38,20 @@ def hackathon_participants(request, hackathon_id): by individual hackathon """ # TODO: Filter hackathons by user type, PARTNER_ADMIN should not have # access to all hackathons and users - print(" +++++++++++++++++++++++ \n"*3) slack_url = None hackathon = get_object_or_404(Hackathon, id=hackathon_id) mentors = [{ 'team': team, 'mentor': team.mentor } for team in hackathon.teams.all()] - print(f"{mentors=}\n") if settings.SLACK_ENABLED: slack_url = f'https://{settings.SLACK_WORKSPACE}.slack.com/team/' badges_csv = 'data:text/csv;charset=utf-8,' + extract_badges_for_hackathon( hackathon, date.today().isoformat(), format='csv') - print(f"\n\n{badges_csv=}\n") awardees = [awardee for category, values in extract_badges_for_hackathon( hackathon, date.today().isoformat()).items() for awardee in values if category not in ['participants', 'judges', 'facilitators']] - print(f"{awardees=}") return render(request, 'hackadmin_participants.html', { 'hackathon': hackathon, 'mentors': mentors, diff --git a/teams/views.py b/teams/views.py index 3a4c0c20..86412fea 100644 --- a/teams/views.py +++ b/teams/views.py @@ -130,7 +130,6 @@ def view_team(request, team_id): create_group_im = (settings.SLACK_ENABLED and settings.SLACK_BOT_TOKEN) mentor_profile = None - print(f"\n\n{settings=}") if team.mentor and settings.SLACK_WORKSPACE: mentor_slack_id = team.mentor.username.split('_')[0] mentor_profile = (f'https://{settings.SLACK_WORKSPACE}.slack.com/'