aa-structures 2.4.0__tar.gz → 2.4.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. {aa_structures-2.4.0 → aa_structures-2.4.1}/PKG-INFO +1 -1
  2. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/__init__.py +1 -1
  3. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/managers.py +34 -53
  4. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/tests/test_managers_1.py +29 -1
  5. {aa_structures-2.4.0 → aa_structures-2.4.1}/LICENSE +0 -0
  6. {aa_structures-2.4.0 → aa_structures-2.4.1}/README.md +0 -0
  7. {aa_structures-2.4.0 → aa_structures-2.4.1}/pyproject.toml +0 -0
  8. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/admin.py +0 -0
  9. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/app_settings.py +0 -0
  10. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/apps.py +0 -0
  11. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/auth_hooks.py +0 -0
  12. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/checks.py +0 -0
  13. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/constants.py +0 -0
  14. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/core/__init__.py +0 -0
  15. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/core/notification_embeds.py +0 -0
  16. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/core/notification_timers.py +0 -0
  17. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/core/serializers.py +0 -0
  18. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/core/sovereignty.py +0 -0
  19. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/core/starbases.py +0 -0
  20. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/forms.py +0 -0
  21. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/helpers/__init__.py +0 -0
  22. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/helpers/general.py +0 -0
  23. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/locale/de/LC_MESSAGES/django.mo +0 -0
  24. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/locale/de/LC_MESSAGES/django.po +0 -0
  25. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/locale/django.pot +0 -0
  26. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/locale/en/LC_MESSAGES/django.mo +0 -0
  27. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/locale/en/LC_MESSAGES/django.po +0 -0
  28. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/locale/es/LC_MESSAGES/django.mo +0 -0
  29. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/locale/es/LC_MESSAGES/django.po +0 -0
  30. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/locale/fr_FR/LC_MESSAGES/django.po +0 -0
  31. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/locale/it_IT/LC_MESSAGES/django.po +0 -0
  32. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/locale/ja/LC_MESSAGES/django.po +0 -0
  33. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/locale/ko/LC_MESSAGES/django.mo +0 -0
  34. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/locale/ko/LC_MESSAGES/django.po +0 -0
  35. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/locale/ko_KR/LC_MESSAGES/django.po +0 -0
  36. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/locale/ru/LC_MESSAGES/django.mo +0 -0
  37. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/locale/ru/LC_MESSAGES/django.po +0 -0
  38. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/locale/uk/LC_MESSAGES/django.po +0 -0
  39. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/locale/zh_Hans/LC_MESSAGES/django.mo +0 -0
  40. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/locale/zh_Hans/LC_MESSAGES/django.po +0 -0
  41. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/management/commands/__init__.py +0 -0
  42. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/management/commands/structures_load_eve.py +0 -0
  43. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/management/commands/structures_preload_eveuniverse.py +0 -0
  44. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/migrations/0001_initial_new.py +0 -0
  45. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/migrations/0002_remove_eveuniverse_relation_names.py +0 -0
  46. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/migrations/0003_add_localization_and_unique_key.py +0 -0
  47. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/migrations/__init__.py +0 -0
  48. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/models/__init__.py +0 -0
  49. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/models/eveuniverse.py +0 -0
  50. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/models/notifications.py +0 -0
  51. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/models/owners.py +0 -0
  52. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/models/structures.py +0 -0
  53. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/providers.py +0 -0
  54. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/css/global.css +0 -0
  55. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/css/main.css +0 -0
  56. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/Spinner-1s-64px-dark.gif +0 -0
  57. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/Spinner-1s-64px-light.gif +0 -0
  58. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/eve_symbol_128.png +0 -0
  59. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/0h.png +0 -0
  60. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/0l.png +0 -0
  61. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/0m.png +0 -0
  62. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/0r.png +0 -0
  63. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/0s.png +0 -0
  64. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/1h.png +0 -0
  65. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/1l.png +0 -0
  66. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/1m.png +0 -0
  67. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/1r.png +0 -0
  68. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/2h.png +0 -0
  69. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/2l.png +0 -0
  70. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/2m.png +0 -0
  71. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/2r.png +0 -0
  72. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/3h.png +0 -0
  73. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/3l.png +0 -0
  74. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/3m.png +0 -0
  75. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/3r.png +0 -0
  76. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/4h.png +0 -0
  77. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/4l.png +0 -0
  78. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/4m.png +0 -0
  79. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/4s.png +0 -0
  80. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/5h.png +0 -0
  81. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/5l.png +0 -0
  82. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/5m.png +0 -0
  83. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/5s.png +0 -0
  84. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/6h.png +0 -0
  85. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/6l.png +0 -0
  86. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/6m.png +0 -0
  87. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/7h.png +0 -0
  88. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/7l.png +0 -0
  89. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/7m.png +0 -0
  90. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/8h.png +0 -0
  91. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/8l.png +0 -0
  92. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/8m.png +0 -0
  93. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/blank.png +0 -0
  94. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/circle.png +0 -0
  95. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/dustwheel.png +0 -0
  96. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/h.png +0 -0
  97. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/l.png +0 -0
  98. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/m.png +0 -0
  99. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/noship.png +0 -0
  100. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/r.png +0 -0
  101. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/tyrannis.png +0 -0
  102. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/tyrannis_blue.png +0 -0
  103. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/tyrannis_darkred.png +0 -0
  104. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/tyrannis_default.png +0 -0
  105. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/panel/tyrannis_revelations.png +0 -0
  106. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/static/structures/img/structures_logo.png +0 -0
  107. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/tasks.py +0 -0
  108. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/templates/structures/base.html +0 -0
  109. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/templates/structures/main.html +0 -0
  110. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/templates/structures/modals/fitting_assets.html +0 -0
  111. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/templates/structures/modals/fitting_gfx.html +0 -0
  112. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/templates/structures/modals/poco_details.html +0 -0
  113. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/templates/structures/modals/starbase_detail.html +0 -0
  114. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/templates/structures/modals/structure_details.html +0 -0
  115. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/templates/structures/modals/tab_general_detail.html +0 -0
  116. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/templates/structures/partials/jump_gates_list.html +0 -0
  117. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/templates/structures/partials/poco_list.html +0 -0
  118. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/templates/structures/partials/structure_list.html +0 -0
  119. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/templates/structures/partials/structure_summary.html +0 -0
  120. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/templates/structures/templatetags/detail_title.html +0 -0
  121. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/templates/structures/templatetags/list_asset.html +0 -0
  122. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/templates/structures/templatetags/list_item.html +0 -0
  123. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/templates/structures/templatetags/list_tax_item.html +0 -0
  124. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/templates/structures/templatetags/list_title.html +0 -0
  125. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/templatetags/__init__.py +0 -0
  126. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/templatetags/structures.py +0 -0
  127. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/tests/__init__.py +0 -0
  128. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/tests/core/__init__.py +0 -0
  129. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/tests/core/test_notification_embeds.py +0 -0
  130. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/tests/core/test_notification_structuretimers.py +0 -0
  131. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/tests/core/test_notifications_timerboard.py +0 -0
  132. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/tests/core/test_serializers.py +0 -0
  133. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/tests/core/test_sovereignty.py +0 -0
  134. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/tests/core/test_starbases.py +0 -0
  135. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/tests/models/__init__.py +0 -0
  136. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/tests/models/test_eveuniverse.py +0 -0
  137. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/tests/models/test_notifications_1.py +0 -0
  138. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/tests/models/test_notifications_2.py +0 -0
  139. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/tests/models/test_notifications_3.py +0 -0
  140. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/tests/models/test_notifications_discord.py +0 -0
  141. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/tests/models/test_owners_1.py +0 -0
  142. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/tests/models/test_owners_2.py +0 -0
  143. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/tests/models/test_owners_3.py +0 -0
  144. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/tests/models/test_structures.py +0 -0
  145. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/tests/test_admin.py +0 -0
  146. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/tests/test_checks.py +0 -0
  147. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/tests/test_helpers.py +0 -0
  148. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/tests/test_integration.py +0 -0
  149. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/tests/test_managers_3.py +0 -0
  150. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/tests/test_tasks.py +0 -0
  151. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/tests/test_views.py +0 -0
  152. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/tests/testdata/__init__.py +0 -0
  153. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/tests/testdata/create_eveuniverse.py +0 -0
  154. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/tests/testdata/entities.json +0 -0
  155. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/tests/testdata/esi_data.json +0 -0
  156. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/tests/testdata/eveuniverse.json +0 -0
  157. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/tests/testdata/factories.py +0 -0
  158. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/tests/testdata/factories_2.py +0 -0
  159. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/tests/testdata/generate_notifications.py +0 -0
  160. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/tests/testdata/generate_notifications_2.py +0 -0
  161. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/tests/testdata/generate_structures.py +0 -0
  162. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/tests/testdata/helpers.py +0 -0
  163. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/tests/testdata/load_eveuniverse.py +0 -0
  164. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/tests/testdata/tasks_loadtest.py +0 -0
  165. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/tests/testdata/test_generate_structures.py +0 -0
  166. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/urls.py +0 -0
  167. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/views.py +0 -0
  168. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/webhooks/__init__.py +0 -0
  169. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/webhooks/core.py +0 -0
  170. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/webhooks/managers.py +0 -0
  171. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/webhooks/models.py +0 -0
  172. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/webhooks/tests/__init__.py +0 -0
  173. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/webhooks/tests/test_core.py +0 -0
  174. {aa_structures-2.4.0 → aa_structures-2.4.1}/structures/webhooks/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: aa-structures
3
- Version: 2.4.0
3
+ Version: 2.4.1
4
4
  Summary: App for managing Eve Online structures with Alliance Auth.
5
5
  Author-email: Erik Kalkoken <kalkoken87@gmail.com>
6
6
  Requires-Python: >=3.8
@@ -2,5 +2,5 @@
2
2
 
3
3
  default_app_config = "structures.apps.StructuresConfig"
4
4
 
5
- __version__ = "2.4.0"
5
+ __version__ = "2.4.1"
6
6
  __title__ = "Structures"
@@ -345,7 +345,7 @@ class StructureManagerBase(models.Manager):
345
345
  obj, created = self.update_or_create_from_dict(structure=structure, owner=owner)
346
346
  return obj, created
347
347
 
348
- def update_or_create_from_dict(self, structure: dict, owner: object) -> tuple:
348
+ def update_or_create_from_dict(self, structure: dict, owner) -> tuple:
349
349
  """update or create structure from given dict"""
350
350
 
351
351
  from .models import StructureService
@@ -354,88 +354,69 @@ class StructureManagerBase(models.Manager):
354
354
  eve_solar_system, _ = EveSolarSystem.objects.get_or_create_esi(
355
355
  id=structure["system_id"]
356
356
  )
357
- fuel_expires_at = (
358
- structure["fuel_expires"] if "fuel_expires" in structure else None
359
- )
360
- next_reinforce_hour = (
361
- structure["next_reinforce_hour"]
362
- if "next_reinforce_hour" in structure
363
- else None
364
- )
365
- next_reinforce_apply = (
366
- structure["next_reinforce_apply"]
367
- if "next_reinforce_apply" in structure
368
- else None
369
- )
370
- reinforce_hour = (
371
- structure["reinforce_hour"] if "reinforce_hour" in structure else None
372
- )
373
- state = (
374
- self.model.State.from_esi_name(structure["state"])
375
- if "state" in structure
376
- else self.model.State.UNKNOWN
377
- )
378
- state_timer_start = (
379
- structure["state_timer_start"] if "state_timer_start" in structure else None
380
- )
381
- state_timer_end = (
382
- structure["state_timer_end"] if "state_timer_end" in structure else None
383
- )
384
- unanchors_at = (
385
- structure["unanchors_at"] if "unanchors_at" in structure else None
386
- )
387
- position_x = structure["position"]["x"] if "position" in structure else None
388
- position_y = structure["position"]["y"] if "position" in structure else None
389
- position_z = structure["position"]["z"] if "position" in structure else None
390
- if "planet_id" in structure:
391
- eve_planet, _ = EvePlanet.objects.get_or_create_esi(
392
- id=structure["planet_id"]
393
- )
357
+ if position := structure.get("position"):
358
+ position_x = position.get("x")
359
+ position_y = position.get("y")
360
+ position_z = position.get("z")
361
+ else:
362
+ position_x = position_y = position_z = None
363
+ if planet_id := structure.get("planet_id"):
364
+ eve_planet, _ = EvePlanet.objects.get_or_create_esi(id=planet_id)
394
365
  else:
395
366
  eve_planet = None
396
- if "moon_id" in structure:
397
- eve_moon, _ = EveMoon.objects.get_or_create_esi(id=structure["moon_id"])
367
+ if moon_id := structure.get("moon_id"):
368
+ eve_moon, _ = EveMoon.objects.get_or_create_esi(id=moon_id)
398
369
  else:
399
370
  eve_moon = None
371
+
372
+ structure_id = structure["structure_id"]
400
373
  try:
401
- old_obj = self.get(id=structure["structure_id"])
374
+ old_obj = self.get(id=structure_id)
402
375
  except self.model.DoesNotExist:
403
376
  old_obj = None
377
+
404
378
  obj, created = self.update_or_create(
405
- id=structure["structure_id"],
379
+ id=structure_id,
406
380
  defaults={
407
381
  "owner": owner,
408
382
  "eve_type": eve_type,
409
- "name": structure["name"],
383
+ "name": structure.get("name", ""),
410
384
  "eve_solar_system": eve_solar_system,
411
385
  "eve_planet": eve_planet,
412
386
  "eve_moon": eve_moon,
413
387
  "position_x": position_x,
414
388
  "position_y": position_y,
415
389
  "position_z": position_z,
416
- "fuel_expires_at": fuel_expires_at,
417
- "next_reinforce_hour": next_reinforce_hour,
418
- "next_reinforce_apply": next_reinforce_apply,
419
- "reinforce_hour": reinforce_hour,
420
- "state": state,
421
- "state_timer_start": state_timer_start,
422
- "state_timer_end": state_timer_end,
423
- "unanchors_at": unanchors_at,
390
+ "fuel_expires_at": structure.get("fuel_expires"),
391
+ "next_reinforce_hour": structure.get("next_reinforce_hour"),
392
+ "next_reinforce_apply": structure.get("next_reinforce_apply"),
393
+ "reinforce_hour": structure.get("reinforce_hour"),
394
+ "state": self.model.State.from_esi_name(structure.get("state", "")),
395
+ "state_timer_start": structure.get("state_timer_start"),
396
+ "state_timer_end": structure.get("state_timer_end"),
397
+ "unanchors_at": structure.get("unanchors_at"),
424
398
  "last_updated_at": now(),
425
399
  },
426
400
  )
401
+
427
402
  if old_obj:
428
403
  obj.handle_fuel_notifications(old_obj)
404
+
429
405
  # Make sure we have dogmas loaded for this type for fittings
430
406
  EveType.objects.get_or_create_esi(
431
407
  id=structure["type_id"], enabled_sections=[EveType.Section.DOGMAS]
432
408
  )
409
+
433
410
  # save related structure services
434
411
  StructureService.objects.filter(structure=obj).delete()
435
412
  if "services" in structure and structure["services"]:
436
413
  for service in structure["services"]:
437
- state = StructureService.State.from_esi_name(service["state"])
438
- args = {"structure": obj, "name": service["name"], "state": state}
414
+ service_state = StructureService.State.from_esi_name(service["state"])
415
+ args = {
416
+ "structure": obj,
417
+ "name": service["name"],
418
+ "state": service_state,
419
+ }
439
420
  StructureService.objects.create(**args)
440
421
 
441
422
  if obj.services.filter(state=StructureService.State.ONLINE).exists():
@@ -8,7 +8,7 @@ from allianceauth.eveonline.models import EveCharacter, EveCorporationInfo
8
8
  from app_utils.esi_testing import EsiClientStub, EsiEndpoint
9
9
  from app_utils.testing import NoSocketsTestCase, create_user_from_evecharacter
10
10
 
11
- from ..models import (
11
+ from structures.models import (
12
12
  EveSovereigntyMap,
13
13
  NotificationType,
14
14
  Owner,
@@ -17,11 +17,13 @@ from ..models import (
17
17
  StructureTag,
18
18
  Webhook,
19
19
  )
20
+
20
21
  from .testdata.factories import (
21
22
  create_eve_sovereignty_map,
22
23
  create_owner_from_user,
23
24
  create_upwell_structure,
24
25
  )
26
+ from .testdata.factories_2 import OwnerFactory
25
27
  from .testdata.helpers import create_structures, load_entities
26
28
  from .testdata.load_eveuniverse import load_eveuniverse
27
29
 
@@ -503,6 +505,32 @@ class TestStructureManagerCreateFromDict(NoSocketsTestCase):
503
505
  self.assertFalse(created)
504
506
  self.assertIsNone(structure.last_online_at)
505
507
 
508
+ def test_can_create_starbase_without_moon(self):
509
+ owner = OwnerFactory()
510
+ structure = {
511
+ "structure_id": 1300000000099,
512
+ "name": "Hidden place",
513
+ "system_id": 30002537,
514
+ "type_id": 16213,
515
+ "moon_id": None,
516
+ "position": {"x": 55028384780.0, "y": 7310316270.0, "z": -163686684205.0},
517
+ }
518
+ structure, created = Structure.objects.update_or_create_from_dict(
519
+ structure, owner
520
+ )
521
+
522
+ # check structure
523
+ structure: Structure
524
+ self.assertTrue(created)
525
+ self.assertEqual(structure.id, 1300000000099)
526
+ self.assertEqual(structure.eve_type_id, 16213)
527
+ self.assertEqual(structure.eve_solar_system_id, 30002537)
528
+ self.assertEqual(structure.owner, owner)
529
+ self.assertEqual(structure.position_x, 55028384780.0)
530
+ self.assertEqual(structure.position_y, 7310316270.0)
531
+ self.assertEqual(structure.position_z, -163686684205.0)
532
+ self.assertEqual(structure.state, Structure.State.UNKNOWN)
533
+
506
534
 
507
535
  class TestStructureTagManager(NoSocketsTestCase):
508
536
  @classmethod
File without changes
File without changes