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

Add gala achievement #3789

Merged
merged 4 commits into from
Mar 22, 2025
Merged

Conversation

aleksandervestlund
Copy link
Contributor

@aleksandervestlund aleksandervestlund commented Mar 17, 2025

  • Primarily developed by @Karolipb.
  • Add gala achievements to encourage attending them.
  • The numbers for the different levels are very loose.
  • At this moment in time, all galas count, but it could also just be "studentgallaer".
  • Have no idea if it works.
  • See frontend PR Add gala achievement lego-webapp#5447.

@jonasdeluna
Copy link
Member

jonasdeluna commented Mar 17, 2025

I like the initiative but I have some concerns.
I feel like galas tend to be more abakom-focused, so it might just turn out to be a "who is/has been a committee member (the longest)" achievement?
The halvingfest was very anti-galla imo, I mean everyone wore galla outfits but it was mostly a mess. Maybe just my experience tho.
Recently we (I) wrote some (ironcally) internal notes on the achievement system but I can share the markdown files here:

New.md
Guidelines.md

**Not saying it's a bad idea just saying there should probably be some considerations around this topic first. I will bring it up on the meeting on wednesday to maybe get some opinions. Also if you (both) have any thoughts on it please share :)

@jonasdeluna
Copy link
Member

jonasdeluna commented Mar 17, 2025

Also as described in the guide, please add it to raritylist :)

**And run makemigrations though if you havent set it up I can do it later its not a huge deal

@aleksandervestlund
Copy link
Contributor Author

aleksandervestlund commented Mar 17, 2025

You make some valid points, but I feel that many members not in Abakom attend the different galas (maybe except for Vaargalla)—especially the itDAGENE banquet, Julebord and the different jubilees. Many first graders also have Immball as their first event, so this may motivate them further to attend. I kind of agree that Halvingfest and Utmatrikuleringsfest are kind of borderline galas, but in the description the dress code is described as gala, so I wasn't sure🤷🤷

@ivarnakken
Copy link
Member

ivarnakken commented Mar 18, 2025

I feel like galas tend to be more abakom-focused, so it might just turn out to be a "who is/has been a committee member (the longest)" achievement?

Imo I don't see galla as something that is only for Abakom, quite the opposite.

I agree that halvingfest should not count

Good job! But please call it "galla" with two Ls 😆

@ollfkaih
Copy link
Contributor

ollfkaih commented Mar 19, 2025

Agree with trophys for attending galas as a potentially nice incentive for more non-Abakom to attend them.

@ivarnakken
Good job! But please call it "galla" with two Ls 😆

Unless we are looking to start using Norwegian variable names, which we only currently do for specific and difficult translations (e.g. genfors), I disagree. [1] [2] [3]

@aleksandervestlund
Copy link
Contributor Author

To fix the spelling is really simple, but what's the conclusion? We can probably delete "Halvingfest" and "Utmatrikuleringsfest" either way since they're not "studentergalla"s

@ivarnakken
Copy link
Member

Unless we are looking to start using Norwegian variable names, which we only currently do for specific and difficult translations (e.g. genfors), I disagree. [1] [2] [3]

... okay fair enough 😓

@jonasdeluna
Copy link
Member

To fix the spelling is really simple, but what's the conclusion? We can probably delete "Halvingfest" and "Utmatrikuleringsfest" either way since they're not "studentergalla"s

The meeting is 16:15 today we may be able to come to a conclusion then 👍👍

@jonasdeluna
Copy link
Member

After a long discussion we have decided to merge this.

@Karolipb
Copy link
Contributor

Glad to hear!! 🤗
With or without "halvingfest" and "utmatrikuleringsfest"?
And the rarities in the front end are probably incorrect and we haven't run makemigrations.

@jonasdeluna
Copy link
Member

Probably without halvingfest and utmatrikuleringsfest. The rarities will probably be reworked soon anyways to have less rarities.

Copy link

coderabbitai bot commented Mar 20, 2025

📝 Walkthrough

Walkthrough

The changes add gala-specific functionality to the achievements system. New constants and collections for gala achievements are introduced in the constants module, and the calculation utilities are updated to include gala rarity values. A dedicated function to verify a user’s gala event count is added to the verification module. In addition, a new promotion function is implemented to handle gala-related checks, and a test case is introduced to validate gala achievement levels. These modifications integrate gala achievements into the existing promotion and achievement workflows.

Changes

File(s) Change Summary
lego/apps/achievements/constants.py
lego/apps/achievements/utils/calculation_utils.py
Added new gala-related constants (GALA_IDENTIFIER, GALA_SUBSTRINGS, GALA_ACHIEVEMENTS) and updated ACHIEVEMENT_RARITIES to include gala values.
lego/apps/achievements/promotion.py Introduced check_gala_related_single_user() for processing gala promotions and updated check_all_promotions() to include a call to this function with an explicit return type.
lego/apps/achievements/tests/tests.py Added GalaAchievementTestCase with test_gala_achievement_levels and updated imports for GALA_IDENTIFIER and MEMBER_GROUP.
lego/apps/achievements/verification.py Added check_total_galas() to verify a user’s event registrations based on gala-specific substrings.
lego/apps/achievements/migrations/0007_alter_achievement_identifier.py Introduced a migration to modify the identifier field of the achievement model to a CharField with predefined choices.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant P as Promotion Module
    participant A as Achievements Data
    participant V as Verification Module

    U->>P: Trigger check_all_promotions()
    P->>P: Call check_gala_related_single_user(user)
    P->>A: Retrieve GALA_ACHIEVEMENTS & GALA_IDENTIFIER
    P->>V: Call check_total_galas(user, required_count)
    V-->>P: Return Boolean result
    P-->>U: Update achievement level based on gala check
Loading
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@jonasdeluna jonasdeluna mentioned this pull request Mar 20, 2025
2 tasks
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🔭 Outside diff range comments (1)
lego/apps/achievements/constants.py (1)

25-25: 💡 Verification agent

🧩 Analysis chain

Update the rarity list as mentioned in the PR discussion.

According to the PR discussion, the rarity list in /utils/calculation_utils.py should be updated when adding new achievements.


🏁 Script executed:

#!/bin/bash
# Check if gala achievements have been added to the rarity list
grep -n "gala" lego/utils/calculation_utils.py

Length of output: 111


I'll run an additional script to search for the calculation_utils.py file anywhere in the repository to verify its correct path. This will help clarify if the file path referenced in the comment needs updating.


🏁 Script executed:

#!/bin/bash
# Search for the file 'calculation_utils.py' anywhere in the repository
fd "calculation_utils.py"

Length of output: 75


Action Required: Correct the File Path for Rarity List Update

  • The comment in lego/apps/achievements/constants.py (line 25) incorrectly references the rarity list file as /utils/calculation_utils.py.
  • The actual file is located at lego/apps/achievements/utils/calculation_utils.py.
  • Please update the comment to direct developers to update the rarity list in lego/apps/achievements/utils/calculation_utils.py when adding new achievements.
🧹 Nitpick comments (2)
lego/apps/achievements/verification.py (1)

140-151: Implementation looks good, but consider future circular import challenges.

The function correctly implements the gala verification by checking event titles against the defined gala substrings. The circular import is properly handled.

For long-term maintainability, you might consider moving all substring constants to a shared module to avoid this pattern of importing within functions.

lego/apps/achievements/tests/tests.py (1)

255-262: Consider testing each achievement level separately.

While the current test verifies the highest achievement level (15 galas), it would be more robust to test each level individually (1, 5, 10, and 15) to ensure the progression works as expected.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f3cb5d0 and 8f4bb2c.

📒 Files selected for processing (6)
  • lego/apps/achievements/constants.py (4 hunks)
  • lego/apps/achievements/migrations/0007_alter_achievement_identifier.py (1 hunks)
  • lego/apps/achievements/promotion.py (2 hunks)
  • lego/apps/achievements/tests/tests.py (3 hunks)
  • lego/apps/achievements/utils/calculation_utils.py (2 hunks)
  • lego/apps/achievements/verification.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • lego/apps/achievements/promotion.py
  • lego/apps/achievements/utils/calculation_utils.py
🧰 Additional context used
🧬 Code Definitions (1)
lego/apps/achievements/constants.py (1)
lego/apps/achievements/verification.py (1) (1)
  • check_total_galas (140-150)
🔇 Additional comments (6)
lego/apps/achievements/migrations/0007_alter_achievement_identifier.py (1)

17-31: New achievement identifier correctly added!

The "gala_count" has been properly added to the list of achievement identifiers in the migration, which allows the database to recognize the new achievement type.

lego/apps/achievements/constants.py (4)

37-37: New identifier correctly defined.

The GALA_IDENTIFIER constant follows the naming pattern of other achievement identifiers.


40-46: Verify these gala events match the PR discussion.

Based on the PR comments, there was discussion about excluding "Halvingfest" and "Utmatrikuleringsfest" from counting towards gala achievements, which appears to be implemented correctly as they're not in this list.

The comments documenting the maximum expected counts for each event type are helpful.

Could you confirm that this list aligns with the final decision from the team meeting mentioned in the PR discussion?


242-263: Achievement levels properly defined.

The implementation follows the established pattern for achievement definitions with appropriate levels (0-3) corresponding to increasing attendance counts (1, 5, 10, 15).


290-290: Achievement collection properly added to ACHIEVEMENTS dictionary.

The gala achievements have been correctly integrated into the global achievements collection.

lego/apps/achievements/tests/tests.py (1)

242-292: Comprehensive test case for gala achievements.

The test thoroughly checks the gala achievement functionality by:

  1. Creating multiple gala events with different name patterns
  2. Registering the user for each event
  3. Verifying the highest achievement level is unlocked

The test aligns with the event name patterns defined in GALA_SUBSTRINGS.

@jonasdeluna jonasdeluna merged commit 55f21ea into webkom:master Mar 22, 2025
3 checks passed
@jonasdeluna
Copy link
Member

@Karolipb If you want the lego pin you should probably message @magnusbrecke on slack or something I think he is responsible for that as he's the leader 👍

@coderabbitai coderabbitai bot mentioned this pull request Mar 25, 2025
2 tasks
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.

5 participants