mirror of
https://github.com/norohind/jubilant-system-core.git
synced 2026-10-22 23:02:08 +03:00
Fix FDEV returning squads with ID we didn't request
This commit is contained in:
1 file changed
+13
-2
+13
-2
@@ -1,6 +1,7 @@
|
|||||||
from . import Queries
|
from . import Queries
|
||||||
import DB
|
import DB
|
||||||
import HookSystem
|
import HookSystem
|
||||||
|
from loguru import logger
|
||||||
|
|
||||||
hook_system = HookSystem.HookSystem()
|
hook_system = HookSystem.HookSystem()
|
||||||
|
|
||||||
@@ -25,7 +26,17 @@ def update_squad(squad_id: int, suppress_absence=False) -> None | int:
|
|||||||
news_info = None # Queries.get_squad_news(squad_id)
|
news_info = None # Queries.get_squad_news(squad_id)
|
||||||
# since Vanguards update NEWS_ENDPOINT always returns 500 b'{"status":500,"message":"Internal Server Error","tag":"bbbdpzgnssvbp"}'
|
# since Vanguards update NEWS_ENDPOINT always returns 500 b'{"status":500,"message":"Internal Server Error","tag":"bbbdpzgnssvbp"}'
|
||||||
|
|
||||||
operation_id = DB.insert_info_news(news_info, squad_info)
|
squad_id_received = squad_info['squad_id']
|
||||||
hook_system.notify_inserted(operation_id)
|
if squad_id_received != squad_id:
|
||||||
|
# A particular case is 90188 which returns 99719 in response
|
||||||
|
# Querying 99719 directly, returns 99719
|
||||||
|
logger.warning(f"squad id mismatch: requested {squad_id}, got {squad_id_received}. Treating as deleted: {not suppress_absence}")
|
||||||
|
if not suppress_absence:
|
||||||
|
operation_id = DB.delete_squadron(squad_id)
|
||||||
|
# TODO: Fire notify_deleted, perhaps?
|
||||||
|
|
||||||
|
else:
|
||||||
|
operation_id = DB.insert_info_news(news_info, squad_info)
|
||||||
|
hook_system.notify_inserted(operation_id)
|
||||||
|
|
||||||
return operation_id
|
return operation_id
|
||||||
Reference in new issue
Block a user