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

remove fake GPS, add newsflash GPS #2738

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion anyway/request_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def get_request_params_from_request_values(vals: dict) -> Optional[RequestParams
years_ago = vals.get("years_ago", BE_CONST.DEFAULT_NUMBER_OF_YEARS_AGO)
lang = vals.get("lang", "he")
location_text = location["text"]
gps = {"lat": news_flash_obj.lat, "lon": news_flash_obj.lon}
gps = location.get("gps")
location_info = location["data"]

if location_info is None:
Expand Down
7 changes: 5 additions & 2 deletions anyway/widgets/road_segment_widgets/street_view_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ def __init__(self, request_params: RequestParams):

def generate_items(self) -> None:
self.items = {
"longitude": self.request_params.gps["lon"],
"latitude": self.request_params.gps["lat"],
"longitude": self.request_params.gps.get("lon"),
"latitude": self.request_params.gps.get("lat"),
}

def is_included(self):
return self.request_params.gps is not None

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe it is safer to do
return self.request_params.gps and self.request_params.gps.get("lon") and self.request_params.gps.get

@staticmethod
def localize_items(request_params: RequestParams, items: Dict) -> Dict:
items["data"]["text"] = {"title": _("Street view widget")}
Expand Down