Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#M01. Judging Automation #112

Conversation

natalijabujevic0708
Copy link
Contributor

Description

After a judge submits his/her score, check if all projects have been scored by all judges in all categories.

How to check if all the projects were scored by all the judges in all categories:

  • Get the number of judges for the Hackathon
  • Get the number of categories in the Hackathon for each project
  • Multiply the number of judges and number of categories to get the total number of objects that should be in the HackProjectScore for each project
  • Get a list of projects in the Hackathon, loop through them and check if the number of objects in HackProjectScore is equal to the required number
  • If all of them have the required number of objects, call the function to calculate the scores and determine the winner

Pull request type

#M01. Judging Automation

Testing

I created 2 Hackathons:
Hackathon 1:

  • teams: Team 1 with Project 1, Team 2 with Project Team 2 and Team 3 with Project Team 3
  • judges: natalija, admin
  • categories: Design, Function

Hackathon 2:

-teams: Team 4 with Project Team 4

  • judges: natalija
  • categories: Design, Function
    hac
    teams
    proj

The judges scored the teams in Hackathon 1:
Team 1 with Project 1 was scored by both judges in all categories
Team 2 with Project Team 2 was scored by just one judge in one category
Team 3 with Project Team 3 was not yet scored
score

The output was
Number of judges: 2
Number of categories: 2
List of projects: [2, 3, 4] #the id's of the projects
Number of objects: 4
Project : 2 Number of objects: 4
A team has been scored by all the judges
Project : 3 Number of objects: 1
Not all teams have been scored by all judges

Since the second project wasn't scored by all the judges, the loop broke and redirected to the list of Hackathons.
output

Second test: All the projects were scored by all the judges:
all_scored

Output was:

Number of judges: 2
Number of categories: 2
List of projects: [2, 3, 4]
Number of objects: 4
Project : 2 Number of objects: 4
A team has been scored by all the judges
Project : 3 Number of objects: 4
A team has been scored by all the judges
Project : 4 Number of objects: 4
A team has been scored by all the judges
All teams have been scored by all judges

all_output

Additional Information

This is just the beginning of judging automation, the next step is (after all the projects are scored) to declare a function that will calculate the overall scores and declare a winner, as well as trigger the winning team's profile to allow them to update their shipping address.

Does this introduce a breaking change

  • Yes
  • No

Copy link
Member

@stefdworschak stefdworschak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@natalijabujevic0708 thanks for adding this! I just have some minor comments.

Could you just also add another view which will show a list of all of the projects ranked by their score which the judges will be redirected to if your logic evaluates that all projects have been scored by all judges? Thanks

@@ -10,6 +10,7 @@

# Create your views here.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please remove this comment and reduce it to only 2 blank lines.

)
team_score.save()


# Number of judges in the Hackathon
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you need all the inline comments. Instead I would extract the logic into a separate function to be called here and add the overall logic to the docstring.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stefdworschak stefdworschak linked an issue Oct 31, 2020 that may be closed by this pull request
@stefdworschak stefdworschak added the hacktoberfest-accepted Accepted PR during Hacktoberfest label Oct 31, 2020
Extract the logic into a separate function check_projects_scores to check if all the projects were scored by all the judges in all categories
@natalijabujevic0708
Copy link
Contributor Author

@stefdworschak no problem, I am going to create the function to calculate the scores and the new view which will show a list of all of the projects ranked by their score in my next PR :)

Copy link
Member

@stefdworschak stefdworschak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@stefdworschak stefdworschak merged commit 9ee54af into Code-Institute-Community:master Oct 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest-accepted Accepted PR during Hacktoberfest
Projects
None yet
Development

Successfully merging this pull request may close these issues.

#M01. Judging Automation
2 participants