From 21cb55d54dbe2caf381965a1788b1d6acd8e9599 Mon Sep 17 00:00:00 2001 From: Stan Soldatov <118521851+iwatkot@users.noreply.github.com> Date: Sat, 15 Feb 2025 18:24:30 +0100 Subject: [PATCH] Is public stats --- maps4fs/generator/map.py | 18 ++---------------- webui/generator/generator.py | 1 + 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/maps4fs/generator/map.py b/maps4fs/generator/map.py index 54a8c9b..dbcae1b 100644 --- a/maps4fs/generator/map.py +++ b/maps4fs/generator/map.py @@ -87,8 +87,9 @@ def __init__( "rotation": rotation, "dtm_provider": dtm_provider.name(), "custom_osm": bool(custom_osm), - "is_public": self.is_session_public(), + "is_public": kwargs.get("is_public", False), } + print(main_settings) send_main_settings(main_settings) except Exception as e: self.logger.error("Error sending main settings: %s", e) @@ -348,18 +349,3 @@ def get_country_by_coordinates(self) -> str: self.logger.error("Error getting country name by coordinates: %s", e) return "Unknown" return "Unknown" - - def is_session_public(self) -> bool | str: - """Check if the session is public. - - Returns: - bool: True if the session is public, False otherwise. - If an error occurs, returns "Unknown". - """ - try: - from webui.config import is_public - - return is_public() - except Exception as e: - self.logger.error("Error checking if the session is public: %s", e) - return "Unknown" diff --git a/webui/generator/generator.py b/webui/generator/generator.py index 21e7a6c..8aaee96 100644 --- a/webui/generator/generator.py +++ b/webui/generator/generator.py @@ -290,6 +290,7 @@ def read_generation_settings(self) -> tuple[mfs.Map, str]: texture_custom_schema=texture_schema, tree_custom_schema=tree_schema, custom_background_path=self.expert_settings.custom_background_path, + is_public=self.public, ) return mp, session_name