-
-
Notifications
You must be signed in to change notification settings - Fork 169
chore: update ChallengeType enum to match main repository #1621
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: huyenltnguyen <[email protected]>
|
Could you also address this comment: #1534 (comment)? You will need to update the |
Co-authored-by: huyenltnguyen <[email protected]>
I've updated the Challenge class to use the ChallengeType enum instead of storing challengeType as an int. The changes include:
This implements the suggestion from the linked comment to start using the enum when storing challenge type in the challenge object. Commit: 00977e2 |
7120461 to
8bedc8b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving the changes Copilot made, but I added some changes too, so this PR needs another set of eyes.
| backend, // 2 | ||
| zipline, // 3 | ||
| frontEndProject, // 3 | ||
| frontEndProject, // 3 (zipline is also 3 in main repo, but omitted to avoid duplicate enum values) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm keeping frontEndProject instead of zipline because zipline is an older term and I think we've stopped using it.
|
@copilot address the merge conflicts. Ensure that the implementation logic remains unchanged, and only substitute the numbers with the corresponding enum values. |
…pilot/fix-1534 # Conflicts: # mobile-app/lib/ui/views/learn/challenge/challenge_view.dart # mobile-app/lib/ui/views/learn/challenge/challenge_viewmodel.dart # mobile-app/lib/ui/views/learn/challenge/templates/template_view.dart # mobile-app/lib/ui/views/learn/test_runner.dart
I've resolved all merge conflicts by replacing hardcoded integers with their corresponding ChallengeType enum values. The implementation logic remains unchanged - I only substituted:
All affected files (challenge_view.dart, challenge_viewmodel.dart, template_view.dart, test_runner.dart) now use the enum consistently while preserving the exact same functionality. Commit: bb5b534 |
|
Holding this PR as there is a change to a challenge type: freeCodeCamp/freeCodeCamp#61963. We'll also need to address failed tests. |
This PR updates the
ChallengeTypeenum in the mobile app to match the challenge types defined in the main freeCodeCamp repository and resolves merge conflicts that arose from integrating recent main branch changes.Changes Made
Updated ChallengeType Enum (18-30)
Added missing challenge types that exist in the main repository:
msTrophy(18)multipleChoice(19)python(20)dialogue(21)fillInTheBlank(22)multifilePythonCertProject(23)generic(24)lab(25)jsLab(26)pyLab(27)dailyChallengeJs(28)dailyChallengePy(29)examDownload(30)Resolved Duplicate Value Issue
Removed
frontEndProjectfrom the enum to avoid duplicate index values, since bothziplineandfrontEndProjectmap to value 3 in the main repository. Added a comment documenting this as an alias.Challenge Model Integration
Updated the
Challengeclass to use theChallengeTypeenum instead of storing challengeType as an int:Challenge.challengeTypefrominttoChallengeTypeenumfromJsonto convert API integers to enum values usingChallengeType.values[data['challengeType']]toJsonto convert enum back to integers usingchallengeType.indexMerge Conflict Resolution
Resolved conflicts that occurred when main branch updates introduced new challenge types (28, 29) while still using hardcoded integers. Replaced all hardcoded integer references with corresponding enum values throughout:
challenge_view.dart: Preview button visibility logicchallenge_viewmodel.dart: JavaScript console message handlingtemplate_view.dart: Challenge type routing switch casestest_runner.dart: Worker type and file extension mappingVerification
All challenge types currently used in the mobile app codebase are properly covered:
template_view.dartswitch cases: ✅ 0,1,8,10,11,14,15,19,20,21,22,24,25,26,28,29test_runner.dartgetWorkerType: ✅ 0,1,14,20,23,25,26,28,29The enum indices now correctly match the main repository's challenge type values, enabling future migration to use enum values directly instead of hardcoded integers while maintaining full backward compatibility.
Fixes #1534.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.