Skip to content

Commit

Permalink
Merge pull request #2516 from shaniwein/2498_bug_vision_zero_10_50_90…
Browse files Browse the repository at this point in the history
…_widget

vision_zero_10_50_90_widget bug fix
  • Loading branch information
atalyaalon authored Dec 27, 2023
2 parents 17a1576 + e1aaaeb commit 0a9beb1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions anyway/request_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class RequestParams:
end_time: datetime.date
lang: str
news_flash_description: Optional[str]
news_flash_title: Optional[str] = None

def __str__(self):
return (
Expand All @@ -54,6 +55,11 @@ def get_request_params_from_request_values(vals: dict) -> Optional[RequestParams
if news_flash_obj is not None and news_flash_obj.description is not None
else None
)
news_flash_title = (
news_flash_obj.title
if news_flash_obj is not None and news_flash_obj.title is not None
else None
)
location = get_location_from_news_flash_or_request_values(news_flash_obj, vals)
if location is None:
return None
Expand Down Expand Up @@ -98,6 +104,7 @@ def get_request_params_from_request_values(vals: dict) -> Optional[RequestParams
end_time=end_time,
lang=lang,
news_flash_description=news_flash_description,
news_flash_title=news_flash_title,
)
logging.debug(f"Ending get_request_params. params: {request_params}")
return request_params
Expand Down
2 changes: 2 additions & 0 deletions anyway/widgets/urban_widgets/vision_zero_10_50_90_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ def is_included(self) -> bool:
for pedestrian_adjective in ["הולך רגל", "הולכת רגל", "הולכי רגל", "הולכות רגל"]:
if self.request_params.news_flash_description and pedestrian_adjective in self.request_params.news_flash_description:
return True
if self.request_params.news_flash_title and pedestrian_adjective in self.request_params.news_flash_title:
return True
return False


Expand Down

0 comments on commit 0a9beb1

Please sign in to comment.