add empty results and remove therapists without phone numbers
This commit is contained in:
parent
c7fe1a1e22
commit
ab18c04d92
11
app.py
11
app.py
@ -39,10 +39,13 @@ def search_for_doctors_with_params():
|
||||
return redirect("/")
|
||||
|
||||
api_handler = APIHandler()
|
||||
locations = api_handler.get_lat_lon_location_list(location)[0]
|
||||
base64_value = api_handler.calculate_req_value_base64(float(locations["lat"]), float(locations["lon"]))
|
||||
api_handler.get_list_of_doctors(float(locations['lat']), float(locations['lon']), base64_value, therapy_types,
|
||||
therapy_age_range, therapy_setting)
|
||||
locations = api_handler.get_lat_lon_location_list(location)
|
||||
if not locations:
|
||||
return render_template("no_result.html")
|
||||
location_match = locations[0]
|
||||
base64_value = api_handler.calculate_req_value_base64(float(location_match["lat"]), float(location_match["lon"]))
|
||||
api_handler.get_list_of_doctors(float(location_match['lat']), float(location_match['lon']), base64_value,
|
||||
therapy_types, therapy_age_range, therapy_setting)
|
||||
api_handler.get_general_doctor_information()
|
||||
api_handler.filter_doctor_information_for_distance(distance*1000)
|
||||
sorted_doctor_phone_times = api_handler.get_doctor_phone_times_sorted(amount_of_weeks)
|
||||
|
@ -35,7 +35,6 @@ class APIHandler:
|
||||
return response.json()
|
||||
|
||||
except JSONDecodeError:
|
||||
print("foo")
|
||||
print(response.text)
|
||||
|
||||
def get_list_of_doctors(self, lat, lon, req_val_base64, therapy_types, therapy_age,
|
||||
@ -95,6 +94,9 @@ class APIHandler:
|
||||
def get_general_doctor_information(self) -> List[DoctorInformation]:
|
||||
general_doctor_information = []
|
||||
for data in self.phone_times.arztPraxisDatas:
|
||||
# Remove empty phone number fields
|
||||
if data.tel == "":
|
||||
continue
|
||||
doctor_day_times = data.tsz
|
||||
phone_times = []
|
||||
for day in doctor_day_times:
|
||||
@ -238,8 +240,8 @@ class APIHandler:
|
||||
try:
|
||||
if "24:00" in date_string:
|
||||
# Sometimes the API returns 24:00 as time, so filtering for those cases and replacing it with a minute
|
||||
# less to work with propery input
|
||||
date_string =date_string.replace("24:00", "23:59")
|
||||
# less to work with proper input
|
||||
date_string = date_string.replace("24:00", "23:59")
|
||||
|
||||
# Add the current year since it is not part of the original date sent by the API
|
||||
parsed_date = datetime.strptime(date_string, format_string).replace(year=datetime.now().year)
|
||||
|
16
templates/no_result.html
Normal file
16
templates/no_result.html
Normal file
@ -0,0 +1,16 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-12 col-md-11 col-sm-10">
|
||||
<h2>Keine Ergebnisse</h2>
|
||||
<div class="alert alert-dismissible alert-primary">
|
||||
<strong>Keine Telefonzeiten mit gegebenem Standort und Distanz gefunden</strong>
|
||||
<a href="/" class="alert-link">Zurück zur Suche</a>, um es erneut zu versuchen
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
Loading…
Reference in New Issue
Block a user