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

Feat 2532 - Change from SubUrbanWidget to AllLocationsWidget #2550

Merged
merged 13 commits into from
Jan 28, 2024

Conversation

EliorGigi
Copy link
Contributor

Move the specified widgets from RoadSegment to AllLocation as per the details in the issue: #2532 .Additionally, I've identified a bug (which i did myself) in passing arguments within the set_critical function in the models.py file. I'm unsure about the calculation when the resolution is set to Street. Please let me know if there are any required modifications.

@EliorGigi EliorGigi requested a review from atalyaalon January 12, 2024 13:16
@codecov-commenter
Copy link

codecov-commenter commented Jan 12, 2024

Codecov Report

Attention: 113 lines in your changes are missing coverage. Please review.

Comparison is base (30003a4) 53.16% compared to head (6b5825e) 52.95%.
Report is 15 commits behind head on dev.

Files Patch % Lines
anyway/parsers/suburban_junctions.py 0.00% 74 Missing ⚠️
anyway/models.py 33.33% 14 Missing ⚠️
...tions_widgets/accident_count_by_severity_widget.py 6.66% 14 Missing ⚠️
main.py 0.00% 5 Missing ⚠️
...ions_widgets/accident_count_by_day_night_widget.py 60.00% 2 Missing ⚠️
anyway/widgets/widget_utils.py 96.61% 2 Missing ⚠️
anyway/request_params.py 83.33% 1 Missing ⚠️
...all_locations_widgets/accidents_heat_map_widget.py 75.00% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #2550      +/-   ##
==========================================
- Coverage   53.16%   52.95%   -0.22%     
==========================================
  Files         117      119       +2     
  Lines        9670     9818     +148     
==========================================
+ Hits         5141     5199      +58     
- Misses       4529     4619      +90     
Flag Coverage Δ
unittests 52.95% <54.61%> (-0.22%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@atalyaalon atalyaalon requested a review from ziv17 January 17, 2024 20:31
anyway/models.py Outdated Show resolved Hide resolved
@atalyaalon
Copy link
Collaborator

@ziv17 can you review? some changes might be needed due to the infra you added (for example with road_segment_id)

Comment on lines +180 to +185
if resolution == BE_CONST.ResolutionCategories.STREET:
filters["involve_yishuv_name"] = location_info.get("yishuv_name")
filters["street1_hebrew"] = location_info.get("street1_hebrew")
elif resolution == BE_CONST.ResolutionCategories.SUBURBAN_ROAD:
filters["road1"] = location_info.get("road1")
filters["road_segment_name"] = location_info.get("road_segment_name")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we handle additional resolutions here, or not yet?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When I got the first task of relocating widgets to AllLocation, Atalya told me to implement it for road+street resolutions, and we will ask about it. We can go ahead with it, but what are the identifiers in the news_flash table for non-urban intersections? Is 'non_urban_intersection_hebrew' sufficient, or should it be 'non_urban_intersection_hebrew' and 'road_segment_name'?

Copy link
Collaborator

Choose a reason for hiding this comment

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

OK then. Just wanted to verify

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

The current situation is OK, in the coming future I'll open a separate issue regarding additional resolutions

@@ -894,25 +894,36 @@ def set_critical(
from anyway.widgets.all_locations_widgets.injured_count_by_severity_widget import (
InjuredCountBySeverityWidget,
)
from anyway.request_params import get_latest_accident_date
from anyway.request_params import get_latest_accident_date, LocationInfo
Copy link
Collaborator

Choose a reason for hiding this comment

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

models.py is a very general file. it specifies the database tables structure. I think it should not depend, or hold specific logic that uses these tables. Code that is related to Widgets should not be here, probably it should be somewhere under widgets.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks!
I agree, and I believe this change will better be in a separate pull request since this logic specific was there before.
@atalyaalon

Copy link
Collaborator

Choose a reason for hiding this comment

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

I agree, @EliorGigi you can create a separate issue and pr for this

Copy link
Collaborator

@ziv17 ziv17 left a comment

Choose a reason for hiding this comment

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

Nice work.

Please see a couple of comments below.

@atalyaalon atalyaalon merged commit 8f3209c into data-for-change:dev Jan 28, 2024
3 checks passed
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.

4 participants