Skip to content

Commit

Permalink
update bridges more
Browse files Browse the repository at this point in the history
  • Loading branch information
pvyParts committed Aug 11, 2024
1 parent a5cce82 commit 8535e8b
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions corptools/api/corporation/dashboards.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from ninja import NinjaAPI

from django.db.models import Sum
from django.utils import timezone

from allianceauth.services.hooks import get_extension_logger
Expand Down Expand Up @@ -43,6 +44,16 @@ def get_dashboard_gates(request):
"corporation__corporation", "system_name"
).prefetch_related('structureservice_set').filter(type_id=35841)

ozone = models.CorpAsset.objects.filter(
type_id=16273,
location_flag="StructureFuel"
).values("location_id").annotate(total=Sum('quantity'))
levels = {}
for o in ozone:
if o["location_id"] not in levels:
levels[o["location_id"]] = 0
levels[o["location_id"]] += o["total"]

second_systems = set()
output = {}
now = timezone.now()
Expand All @@ -62,7 +73,7 @@ def get_dashboard_gates(request):
output[to_sys]["end"] = {
"system_name": s.system_name.name,
"system_id": s.system_name_id,
"ozone": s.ozone_level,
"ozone": levels.get(s.structure_id),
"known": True,
"active": active,
"expires": days,
Expand All @@ -73,7 +84,7 @@ def get_dashboard_gates(request):
output[from_sys]["start"] = {
"system_name": s.system_name.name,
"system_id": s.system_name_id,
"ozone": s.ozone_level,
"ozone": levels.get(s.structure_id),
"known": True,
"active": active,
"expires": days,
Expand Down

0 comments on commit 8535e8b

Please sign in to comment.