workflows.utils.record_scores.write_overall_scores_to_database#

workflows.utils.record_scores.write_overall_scores_to_database(database, pr_number, pr_author, pr_closed_datetime, merge_commit, submission_main, overall_scores)#

Writes an entry in the JSON scores database. The scores database has this structure:

{
   "<pr_number>": {
       "username": "<pr_author>",
       "submission_datetime": "<pr_closed_datetime>",
       "merge_commit": "<pr_merge_commit_sha>",
       "submission_main": "<SUBMISSION_MAIN_from_pr_config.json>",
       "test_sets": {
           "<test_set_filename>": "<score>",
           ...
       }
   }
}

As tables, the database has two tables: submissions, and test_set_scores. The submissions table has these columns: pr_number, username, submission_datetime, and test_sets. The primary key is pr_number. The test_set_scores table has these columns: test_set, and score. The primary key is a compound key of pr_number and test_set.

Parameters:
  • database (dict) – The scores database.

  • pr_number (int) – The pull request number.

  • pr_author (str) – The author of the pull request.

  • pr_closed_datetime (str) – The datetime the pull request was closed.

  • merge_commit (str) – The SHA of the commit when the pull request was merged.

  • submission_main (str) – SUBMISSION_MAIN from the submission’s pr_config.json.

  • overall_scores (dict) – A dictionary from test set filenames (excluding file extensions) to strings representing scores.