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 credits addition/deduction type #29

Open
MartinKolarik opened this issue Oct 9, 2024 · 0 comments
Open

Add credits addition/deduction type #29

MartinKolarik opened this issue Oct 9, 2024 · 0 comments

Comments

@MartinKolarik
Copy link
Member

The field adopted_probe in gp_credits_additions is marked as a foreign key with on delete set null. On the probes page, we're using an is not null check to determine if the addition of credits was related to a probe or something else (sponsorship, etc.). This, unfortunately, means that when a probe is deleted, all its credits additions become "not related to a probe," and the credits total on the probes page doesn't match the credits total on the credits page, which is confusing.

My first thought was simply dropping the foreign key, but there are related issues with how we currently handle additions:

  • there's no "type" to programmatically distinguish the cause of addition
  • the meta comment is a bit problematic as it's unstructured text, and if we want to update the wording, it requires regex based updates of the whole table

Here's an idea that might solve all of the above:

  • drop the comment and adopted_probe fields
  • add a reason enum, which can be adopted_probe, recurring_sponsorship, one_time_sponsorship
  • add a meta field as json, which contains whatever references we need based on the reason; e.g. for probes it would contain the name and IP, and the client would construct the comment based on that

Partly related #22.

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

No branches or pull requests

1 participant