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

Cpp23 #334

Merged
merged 3 commits into from
May 26, 2024
Merged

Cpp23 #334

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions docs/porting_to_new_standard.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
### Porting to new standard

When porting the questions to a new standard, use the previous issues https://github.com/knatten/cppquiz/issues/77 and https://github.com/knatten/cppquiz/issues/293 for inspiration.

The main steps are as follows, see previous issues for details:
- Create a porting repository (previously, we've used https://github.com/knatten/cppquiz17 and https://github.com/knatten/cppquiz23)
- Copy the md files from the previous such repository to the new one
- In the main cppquiz repo, export the questions: `python manage.py export_questions_to_repo <path to porting repo>`
- Create a [personal access token](https://github.com/settings/tokens?type=beta) with permissions to create issues in the porting repo
- In the main cppquiz repo, auto-generate issues: `python manage.py create_issues <user name> <porting repo name> <access token>`
- Copy the `.github/pull_request_template.md` pull request template from a previous porting repo to the new one
- Use the porting repo to port all the questions (see previous porting issues)
- In the main cppquiz repo, import the updated questions: `python manage.py update_questions_from_repo <path to porting repo>`
2 changes: 1 addition & 1 deletion quiz/management/commands/create_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def handle(self, *args, **options):
print("Creating issue for " + str(q.id))
title = 'Update question ' + str(q.id)
body = text_generator.get_issue(q)
data = json.dumps({'issue': {'title': title, 'body': body}})
data = json.dumps({'issue': {'title': title, 'body': body}}).encode("utf-8")
url = 'https://api.github.com/repos/' + options['user'][0] + '/' + options['repo'][0] + '/import/issues'
headers = {
'Authorization': 'token ' + options['token'][0],
Expand Down
14 changes: 7 additions & 7 deletions quiz/management/commands/text_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ def get_result_display(question):
template = """
### Thanks for helping!

Thank you for helping to port this question from C++11 to C++17.
Thank you for helping to port this question from C++17 to C++23.

You'll find the source code in [question.cpp]({{QUESTION_PATH}}question.cpp), this should normally not need modification.

In C++11, the correct answer is:
In C++17, the correct answer is:
> {{ANSWER}}

Please verify that this is still correct in C++17. If it is, please do the following:
Please verify that this is still correct in C++23. If it is, please do the following:
{{BULLET}} Update [explanation.md]({{QUESTION_PATH}}explanation.md):
{{BULLET}} Refer to the correct section numbers
{{BULLET}} Use updated quotes from those sections (the wording might have changed)
Expand All @@ -46,7 +46,7 @@ def get_result_display(question):

If you get stuck, please describe the problem in detail in a comment to the issue, and a maintainer will add the `help wanted` tag so others can chime in.

If the correct answer has changed from C++11 to C++17, you can either just leave a comment in this issue, or see the instructions for [updating meta data]({{ROOT_PATH}}METADATA_HOWTO.md).
If the correct answer has changed from C++17 to C++23, you can either just leave a comment in this issue, or see the instructions for [updating meta data]({{ROOT_PATH}}METADATA_HOWTO.md).
"""

meta_data_howto = """
Expand Down Expand Up @@ -75,15 +75,15 @@ def get_result_display(question):
"""

main_readme = """
## Porting CppQuiz.org questions to C++17
## Porting CppQuiz.org questions to C++23

CppQuiz.org is an open source C++ quiz site. If you're unfamiliar with it, you can read more in [its "About" section](https://cppquiz.org/quiz/about/).

All the CppQuiz questions are currently targetting C++11. We need to update them for C++17. Most questions will still have the same answers, we just need to update the explanations and references to the standard. A few questions will also have different answers.
All the CppQuiz questions are currently targetting C++17. We need to update them for C++23. Most questions will still have the same answers, we just need to update the explanations and references to the standard. A few questions will also have different answers.

Doing this all by myself is going to take months, so I would very much appreciate some help from the community. To make that as simple as possible, I've created this repository containing all the questions. There is a [directory for each question](/questions), named after the question number. That directory contains the source code of the question in a `.cpp` file, the hint and explanation in `.md` files, as well as a `README.md` explaining everything you need to do to port the question. There's also an issue for each question, making it easier to track progress. The issue has the same information as the `README.md` file.

As soon as we've updated all the questions in this repository, I'll import them back into CppQuiz, and from then on CppQuiz will always ask about C++17.
As soon as we've updated all the questions in this repository, I'll import them back into CppQuiz, and from then on CppQuiz will always ask about C++23.

### How to help porting questions
There are two ways to contribute, listed below. I prefer the first alternative, but if that prevents you from contributing, the second is also ok.
Expand Down
Loading