Skip to content

Commit

Permalink
don't fail on messages without signal level
Browse files Browse the repository at this point in the history
  • Loading branch information
wiedehopf committed Dec 8, 2024
1 parent ae4e420 commit 370b24f
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions rootfs/webapp/acarshub_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,16 +547,17 @@ def add_message(params, message_type, message_from_json, backup=False):
# We'll see if the level is in the database already, and if so, increment the counter
# If not, we'll add it in

found_level = (
session.query(messagesLevel)
.filter(messagesLevel.level == params["level"])
.first()
)
if params["level"]:
found_level = (
session.query(messagesLevel)
.filter(messagesLevel.level == params["level"])
.first()
)

if found_level is not None:
found_level.count += 1
else:
session.add(messagesLevel(level=params["level"], count=1))
if found_level is not None:
found_level.count += 1
else:
session.add(messagesLevel(level=params["level"], count=1))

if len(params["text"]) > 0 and alert_terms:
for search_term in alert_terms:
Expand Down

0 comments on commit 370b24f

Please sign in to comment.