Skip to content

Commit

Permalink
fix: pending/watchlist filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohamed-Hacene committed May 13, 2024
1 parent c4360c8 commit 02e8291
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
14 changes: 5 additions & 9 deletions backend/core/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,8 @@ def measures_to_review(user: User):
)
measures = (
AppliedControl.objects.filter(id__in=object_ids_view)
.filter(eta__lte=date.today() + timedelta(days=30))
.exclude(status__iexact="done")
.order_by("eta")
.filter(expiry_date__lte=date.today() + timedelta(days=30))
.order_by("expiry_date")
)

return measures
Expand Down Expand Up @@ -576,7 +575,7 @@ def applied_control_per_cur_risk(user: User):
for lvl in get_rating_options(user):
cnt = (
AppliedControl.objects.filter(id__in=object_ids_view)
.exclude(status="done")
.exclude(status="active")
.filter(risk_scenarios__current_level=lvl[0])
.count()
)
Expand Down Expand Up @@ -841,12 +840,9 @@ def acceptances_to_review(user: User):
acceptances = (
RiskAcceptance.objects.filter(id__in=object_ids_view)
.filter(expiry_date__lte=date.today() + timedelta(days=30))
.order_by("expiry_date")
)
acceptances |= (
RiskAcceptance.objects.filter(id__in=object_ids_view)
.filter(approver=user)
.filter(state="submitted")
.filter(state__in=["submitted", "accepted"])
.order_by("expiry_date")
)

return acceptances
Expand Down
2 changes: 1 addition & 1 deletion backend/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ def todo(self, request):

measures = sorted(
AppliedControl.objects.filter(id__in=object_ids_view)
.exclude(status="done")
.exclude(status="active")
.order_by("eta"),
key=lambda mtg: mtg.get_ranking_score(),
reverse=True,
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/routes/(app)/analytics/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
'eta',
'expiry_date'
]),
meta: data.measures
meta: data.measures_to_review
};
const riskAcceptanceWatchlistTable: TableSource = {
Expand Down

0 comments on commit 02e8291

Please sign in to comment.