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

feat(report_bot): add a leaderboard #119

Open
wants to merge 20 commits into
base: main
Choose a base branch
from

Conversation

pythonbrad
Copy link
Member

@pythonbrad pythonbrad commented Aug 23, 2024

Related issues

Change

  • removed the anonymized to be able to get user answers
  • restructured the code to apply the DRY principle
  • saved the quiz data in order to be able to get poll results

TODO

  • close the quiz and get user answers
  • fetch quiz user answers in a database
  • generate a leaderboard
  • sanction / mention user who retract their answers
  • log to stderr
  • put reusable functions like escp in utils/function.sh
  • announce the result (message)
  • Review the workflow file

Notice

I plan to use a git repo as a database. Hence, the report_quiz action will hold a private repo.

  • The created quiz information will be committed in the git repo
    git commit -m "Added a new quiz"
  • The user answers will be committed in the git repo
    git commit -m "Added new user answers to quiz:<quiz_id>"
  • The final quiz stats will be committed in the git repo
    git commit -m "Closed quiz:<quiz_id> and generated result"

Useful link

pythonbrad and others added 3 commits August 22, 2024 21:03
In saving the quiz data, we will be able to retrieve
the submitted answers and build the leaderboard
This commit introduces the following changes:
- Added a function `get_user_answers` and `fetch_quiz_data`
 to be able to get the user quiz answers and update the quiz_data database
- Restricted the quiz answers to one answer submission per user per quiz
@pythonbrad pythonbrad force-pushed the reportquiz_leaderboard branch 2 times, most recently from 3280748 to 48e548f Compare August 24, 2024 10:34
When a quiz_data is created, the user_answers field is not present
and the addition can't proceed.
As change, we will use an empty value in this case
- added the possibility to generate and send the leaderboard
Stop all the active quiz, submit the result and archive the quiz data
Added a friendly announcement message.

Additonnal change
- moved the price calculation from `generate_leaderboard` to `compute_total_score`.
- fixed issue when a quiz data contains no user answer submission during
 the score computation
- Added the start new competition action
- Added the fetching of the quiz user answers
- Added the backup of the data using git
- Added the ending of a current competition
@pythonbrad pythonbrad marked this pull request as ready for review August 26, 2024 19:32
@pythonbrad
Copy link
Member Author

@Sanix-Darker , @elhmn , this pr is ready for review.

HanslettTheDev and others added 10 commits October 1, 2024 12:52
Added a documentation for the report quiz bot
The close competition fail during the closing of a already closed quiz.
Since the status of this process is not important, we will ignore it.
Like that the closing of the competition can proceed.
This commit handles the case when there is no results
 during the closing of the competition.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants