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: enable/disable achievements #108

Merged
merged 2 commits into from
Oct 25, 2023
Merged

Conversation

irisdv
Copy link
Collaborator

@irisdv irisdv commented Oct 20, 2023

Close #104

I used an Option<bool> to avoid having no achievements shown when we pass the feature in production, so if there is not disabled specified or if it's set to false it would fetch those achievements, wdyt ?

@irisdv irisdv changed the title feat: allow disabling achievements feat: enable/disable achievements Oct 20, 2023
@irisdv irisdv requested a review from Th0rgal October 20, 2023 06:15
@irisdv irisdv added the 🔥 Ready for review This pull request needs a review label Oct 20, 2023
Copy link
Member

@Th0rgal Th0rgal left a comment

Choose a reason for hiding this comment

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

What you did work, but since you always want to interpret an unspecified category_disabled as 'false', I would suggest you to user serde feature (you might need to change pub_struct! macro or write the pub struct without a macro).

#[derive(Debug, Serialize, Deserialize)]
pub struct UserAchievements {
    category_name: String,
    category_desc: String,
    category_img_url: String,
    category_type: String,
    #[serde(default = "default_category_disabled")]
    category_disabled: bool,
    achievements: Vec<UserAchievement>,
}

fn default_category_disabled() -> bool {
    false
}

@Th0rgal Th0rgal added ❌ Change request Change requested from reviewer and removed 🔥 Ready for review This pull request needs a review labels Oct 23, 2023
@irisdv irisdv added the 🔥 Ready for review This pull request needs a review label Oct 24, 2023
@irisdv irisdv requested a review from Th0rgal October 24, 2023 08:01
@irisdv irisdv removed the ❌ Change request Change requested from reviewer label Oct 24, 2023
Copy link
Member

@Th0rgal Th0rgal left a comment

Choose a reason for hiding this comment

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

lgtm

@Th0rgal Th0rgal merged commit f573cac into master Oct 25, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔥 Ready for review This pull request needs a review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ability to disable achievements
2 participants