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

Implement ordering on the Surge Alert table based on status and opens fields #2036

Closed
3 tasks done
samshara opened this issue Feb 8, 2024 · 4 comments
Closed
3 tasks done
Assignees
Labels

Comments

@samshara
Copy link
Member

samshara commented Feb 8, 2024

based on IFRCGo/go-web-app#512 (comment)

Default Ordering Rules

  1. Open alerts should be displayed at the top.
  2. Stood downs should follow open alerts.
  3. Closed alerts should be displayed last.
    Within the open alerts category, sorting should be done based on the alert date (opens).

The status calculation is performed on the client side right now, and the logic is implemented as follows:

  1. If the alert status is marked as stood_down, then the status is Stood Down.
  2. If the closing timestamp (closes) is earlier than the current date, the status is displayed as Closed. Otherwise, it is displayed as Open.

Workplan

  • Add Status field
    • Index the field
    • Define Enum values according to the ordering rules
  • Define a cron job to update the status field, update every 12 hours (first trigger on 0:1 UTC, first hour of UTC)
  • Add option to order by status and opens (date field)

cc @thenav56 @k9845

@samshara samshara transferred this issue from IFRCGo/go-web-app Feb 8, 2024
@samshara samshara assigned k9845 and susilnem and unassigned k9845 Feb 8, 2024
@samshara samshara changed the title Implement default ordering on the surge_alert table based on status Implement ordering on the Surge Alert table based on status and opens fields Feb 9, 2024
@tovari
Copy link

tovari commented Mar 4, 2024

could you please explain why do we have no Open alerts in this emergency page:
https://go-stage.ifrc.org/emergencies/6646/surge

while we have many Open alerts on the All Alerts page for this emergency:
https://go-stage.ifrc.org/alerts/all?event=6646

@szabozoltan69
Copy link
Contributor

szabozoltan69 commented Mar 4, 2024

On the page where there are many open alerts we do not use these constraints:
is_active=true
and
end >= 2024-03-04

These filters filter out all the surge alerts concerning to event 6646.
So maybe the "is_active" vs. "open" conflicts here.

@szabozoltan69
Copy link
Contributor

(If I resend the 0-giving request with curl with removing these 2 constraints, in the response there are all the 57 alerts that is on the other page, other request.)

@samshara
Copy link
Member Author

samshara commented Mar 5, 2024

On the page where there are many open alerts we do not use these constraints: is_active=true and end >= 2024-03-04

These filters filter out all the surge alerts concerning to event 6646. So maybe the "is_active" vs. "open" conflicts here.

@szabozoltan69 Thanks for the quick assessment. @tovari this is indeed the case. We could remove those constraints (is_active=true, end >=2024-03-04[today's date]) from the query or include those constraints when calculating the status. @anamariaescobar do you have any suggestions?

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

No branches or pull requests

5 participants