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

(BEDS-875) Add rewards chart history based on premium perks #1220

Open
wants to merge 6 commits into
base: staging
Choose a base branch
from

Conversation

remoterami
Copy link
Contributor

No description provided.

@remoterami remoterami force-pushed the BEDS-875/rewards-chart branch from 517ce8d to c6d5fa4 Compare December 18, 2024 14:56
Copy link

cloudflare-workers-and-pages bot commented Dec 18, 2024

Deploying beaconchain with  Cloudflare Pages  Cloudflare Pages

Latest commit: c6d5fa4
Status: ✅  Deploy successful!
Preview URL: https://70c9eb59.beaconchain.pages.dev
Branch Preview URL: https://beds-875-rewards-chart.beaconchain.pages.dev

View logs

backend/pkg/api/types/user.go Show resolved Hide resolved
backend/pkg/api/handlers/handler_service.go Outdated Show resolved Hide resolved
backend/pkg/api/handlers/public.go Show resolved Hide resolved
backend/pkg/api/handlers/public.go Outdated Show resolved Hide resolved
ChartRewards
)

func (d ChartType) Int() int {
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the int value that we pass is invalid?

Should we have a function that checks the valid number

func (d ChartType) IsValid() bool {
    return d >= ChartDefault && d <= ChartRewards
}

and maybe a function that stringify for debugging and logging purposes?

func (d ChartType) String() string {
    switch d {
    case ChartDefault:
        return "Default"
    case ChartRewards:
        return "Rewards"
    default:
        return "Unknown"
    }
}

Copy link
Contributor Author

@remoterami remoterami Dec 20, 2024

Choose a reason for hiding this comment

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

What is the int value that we pass is invalid?

This should be covered here already:

func IsInvalidEnum(e Enum) bool {
return e.Int() == -1
}

and maybe a function that stringify for debugging and logging purposes?

It's meant as an internal type only, thought it's cleaner than passing strings or numbers. It doesn't depend on user params and isn't logged anywhere, so I think that's not needed.

@sasha-bitfly
Copy link
Contributor

@remoterami Ideally to cover the changes with tests. Unit tests are nice, but api tests can be fine.

Copy link
Contributor

@LuccaBitfly LuccaBitfly left a comment

Choose a reason for hiding this comment

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

lgtm

@remoterami remoterami force-pushed the BEDS-875/rewards-chart branch from 8e79801 to 362046d Compare December 23, 2024 10:36
@remoterami
Copy link
Contributor Author

@remoterami Ideally to cover the changes with tests. Unit tests are nice, but api tests can be fine.

I've added some tests and did some refactoring. Could probably further solidify and generalize the testing setup, but that depends on our coverage goals and I didn't want to over-engineer for now. Open to suggestions though

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.

3 participants