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

Appeal History - Appeal Refactor #2180

Open
thenav56 opened this issue Jun 21, 2024 · 0 comments
Open

Appeal History - Appeal Refactor #2180

thenav56 opened this issue Jun 21, 2024 · 0 comments

Comments

@thenav56
Copy link
Member

thenav56 commented Jun 21, 2024

Problem Statement

Currently, we have two entities: Appeal and AppealHistory, with the latter used to track changes to Appeal. We have replaced Appeal in all aggregated data and listings where Appeal was originally used. While valid_from and valid_to attributes in AppealHistory allow us to fetch data for specific time periods, these attributes are not utilized within the system itself but only at the endpoint level. This has resulted in a complex structure for endpoints where both Appeal and AppealHistory are needed for calculations, requiring manual definition of valid_from and valid_to attributes.

Some places where it is used

go-api/api/drf_views.py

Lines 272 to 277 in 06f1bc0

all_appealhistory = AppealHistory.objects.select_related("appeal").filter(
country=country,
appeal__code__isnull=False,
valid_from__lt=now, # TODO: Allow user to provide this?
valid_to__gt=now, # TODO: Allow user to provide this?
)

go-api/api/drf_views.py

Lines 807 to 814 in 06f1bc0

def list(self, request, *args, **kwargs):
date = request.GET.get("date", timezone.now())
queryset = self.filter_queryset(
self.get_queryset().filter(
valid_from__lt=date,
valid_to__gt=date,
)
)

Proposal

To simplify the structure and usage, we propose the following:

  1. Replace all instances where AppealHistory is used with Appeal.
  2. Create a separate endpoint dedicated to retrieving AppealHistory and treat it as a separate entity.

Related Discussions/PRs

cc: @szabozoltan69 @tovari @batpad @frozenhelium @samshara @udaynwa @susilnem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant