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
13 changes: 3 additions & 10 deletions 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 = location["gps"]
gps = {"lat": news_flash_obj.lat, "lon": news_flash_obj.lon}
atalyaalon marked this conversation as resolved.
Show resolved Hide resolved
location_info = location["data"]

if location_info is None:
Expand Down Expand Up @@ -220,9 +220,7 @@ def extract_road_segment_location(road_segment_id):
data["road_segment_name"] = road_segment_name
data["road_segment_id"] = int(road_segment_id)
text = get_road_segment_location_text(road1, road_segment_name)
# fake gps - todo: fix
gps = {"lat": 32.825610, "lon": 35.165395}
return {"name": "location", "data": data, "gps": gps, "text": text}
return {"name": "location", "data": data, "text": text}


# todo: fill both codes and names into location
Expand All @@ -233,9 +231,7 @@ def extract_street_location(input_vals: dict):
for k in ["yishuv_name", "yishuv_symbol", "street1", "street1_hebrew"]:
data[k] = vals[k]
text = get_street_location_text(vals["yishuv_name"], vals["street1_hebrew"])
# fake gps - todo: fix
gps = {"lat": 32.825610, "lon": 35.165395}
return {"name": "location", "data": data, "gps": gps, "text": text}
return {"name": "location", "data": data, "text": text}


def extract_street_location_suggestion_version(input_vals: dict):
Expand Down Expand Up @@ -271,12 +267,9 @@ def extract_non_urban_intersection_location(input_vals: dict):
data = {"resolution": BE_CONST.ResolutionCategories.SUBURBAN_JUNCTION}
for k in ["non_urban_intersection", "non_urban_intersection_hebrew", "road1", "road2"]:
data[k] = vals[k]
# fake gps - todo: fix
gps = {"lat": 32.825610, "lon": 35.165395}
return {
"name": "location",
"data": data,
"gps": gps,
"text": vals["non_urban_intersection_hebrew"],
}

Expand Down
3 changes: 1 addition & 2 deletions tests/test_request_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ class TestRequestParams(unittest.TestCase):
'resolution': BE_CONST.ResolutionCategories.SUBURBAN_JUNCTION,
'road1': 669,
'road2': 71},
'gps': {'lat': 32.82561, 'lon': 35.165395},
'name': 'location',
'text': 'צומת השיטה'}
nf = NewsFlash()
Expand All @@ -46,7 +45,7 @@ class TestRequestParams(unittest.TestCase):
lang='he',
news_flash_description=nf.description,
news_flash_title=nf.title,
gps={"lat": 32.825610, "lon": 35.165395}
gps={"lat": None, "lon": None}
)

@patch("anyway.request_params.fill_missing_non_urban_intersection_values")
Expand Down
Loading