Porównaj commity

...

2 Commity

Autor SHA1 Wiadomość Data
Hartmut Holzgraefe 2a33e4d296 Merge branch 'django-3.2' of https://github.com/hholzgra/maposmatic into django-3.2 2023-08-02 23:09:35 +02:00
Hartmut Holzgraefe 98cea4fbdb check that the places db table is properly imported 2023-08-02 23:08:45 +02:00
2 zmienionych plików z 36 dodań i 0 usunięć

Wyświetl plik

@ -98,6 +98,29 @@ def get_waymarked_database_last_update():
return None
def get_osmnames_table_ok():
cursor = None
try:
cursor = connections['osm'].cursor()
if cursor is None:
return False
cursor.execute("""select osm_id from place where name = 'Bielefeld'""")
id = cursor.fetchone()
if id is None or id[0] <= 0:
return False
return True
except:
pass
finally:
# Close the DB cursor if necessary
if cursor is not None and not cursor.closed:
cursor.close()
return False
def queue_states():
queues = {}
@ -169,6 +192,8 @@ def all(request):
and datetime.datetime.utcnow() - waymarked_lastupdate < datetime.timedelta(minutes=120)
or False)
osmnames_ok = get_osmnames_table_ok()
if daemon_running and gis_lag_ok and waymarked_lag_ok:
platform_status = 'check'
elif daemon_running and gis_lastupdate and not (gis_lag_ok and waymarked_lag_ok):
@ -203,6 +228,7 @@ def all(request):
'gis_lag_ok': gis_lag_ok,
'waymarked_lastupdate': waymarked_lastupdate,
'waymarked_lag_ok': waymarked_lag_ok,
'osmnames_ok': osmnames_ok,
'utc_now': datetime.datetime.utcnow(),
'platform_status': platform_status,

Wyświetl plik

@ -62,5 +62,15 @@
{% endif %}
{% endif %}
{% if osmnames_ok %}
<div class="alert alert-success">
<i class="fas fa-check"></i> {% blocktrans %}The OsmNames Places table data is OK.{% endblocktrans %}
</div>
{% else %}
<div class="alert alert-danger">
<i class="fas fa-times"></i> {% blocktrans %}The OsmNames Places table data is missing.{% endblocktrans %}
</div>
{% endif %}
</p>
</div>