Commit Graph

80 Commits

Author SHA1 Message Date
8e92a63895 Add renovate.json 2025-12-19 16:00:14 +01:00
Torsten Schulz (local)
f7710b64c9 Refactor WeatherWorker SQL query: Replace the existing weather update logic with a new query that assigns random weather types to each region, ensuring individual updates. Clean up logging messages for clarity. 2025-12-18 15:34:16 +01:00
Torsten Schulz (local)
6d12c70d84 Entferne Info-Logs aus den Worker-Klassen: Reduziere die Protokollierung in ProduceWorker, DirectorWorker und TransportWorker, um die Ausgabe zu optimieren und nur Fehler zu protokollieren. 2025-12-16 12:58:37 +01:00
Torsten Schulz (local)
d2e253b79a Füge erweiterte SQL-Abfragen und Logging in ProduceWorker hinzu: Implementiere Update- und Insert-Logik für das Inventar und verbessere die Fehlerausgaben. 2025-12-16 10:52:06 +01:00
Torsten Schulz (local)
74fee2d4c9 Verbessere Fehlerbehandlung in SQL-Abfragen: Füge detaillierte Fehlermeldungen für Vorbereitungs- und Ausführungsfehler in den Director- und Politics-Workern hinzu. 2025-12-16 08:52:08 +01:00
Torsten Schulz (local)
b45990c1b6 Aktualisiere Benachrichtigungsabfragen: Ersetze character_id durch user_id in den Benachrichtigungs-INSERT-Abfragen und optimiere die Abfragen zur Auswahl des Benutzers. 2025-12-16 08:24:46 +01:00
Torsten Schulz (local)
ae90166adb Aktualisiere Benachrichtigungsabfragen: Ersetze user_id durch character_id und optimiere die Abfragen zur Auswahl des Charakters. 2025-12-15 21:20:30 +01:00
Torsten Schulz (local)
2aa4e7c666 Füge VSCode-Build-Tasks hinzu: Erstelle Aufgaben für den Build-Prozess und Clippy-Überprüfungen. 2025-12-13 23:40:20 +01:00
Torsten Schulz (local)
ce06b1a4f0 Verbessere SQL-Abfragen im Produktionsworker: Optimiere die Abfrage für abgeschlossene Produktionen und verbessere die Lesbarkeit der Preisberechnung. 2025-12-13 12:17:00 +01:00
Torsten Schulz (local)
10bc1e5a52 Refactor SQL queries into a dedicated module
- Moved SQL queries from multiple worker files into `src/worker/sql.rs` for better organization and maintainability.
- Updated references in `stockage_manager.rs`, `transport.rs`, `underground.rs`, `user_character.rs`, and `value_recalculation.rs` to use the new centralized SQL queries.
- Improved code readability by replacing `.get(0)` with `.first()` for better clarity when retrieving the first row from query results.
- Cleaned up unnecessary comments and consolidated related SQL queries.
2025-12-13 11:57:28 +01:00
Torsten Schulz (local)
a9d490ce38 Refactor SQL queries into centralized module
- Moved various SQL query strings from individual worker files into a new `sql.rs` module for better organization and reusability.
- Updated `events.rs`, `underground.rs`, and `weather.rs` to use the centralized SQL queries.
- Removed redundant query definitions from `events.rs`, `underground.rs`, and `weather.rs`.
2025-12-12 15:18:30 +01:00
Torsten Schulz (local)
eab46f5cdc Verbessere Preisberechnung im DirectorWorker: Implementiere kumulative Steuerberechnung basierend auf regionalen Büros und deren Befreiungen, um die Genauigkeit der Einnahmen und Auszahlungen zu erhöhen. 2025-12-12 07:52:53 +01:00
Torsten Schulz (local)
1134be0f8d Enhance tax calculation in DirectorWorker: Integrate DEFAULT_TAX_PERCENT and DEFAULT_TREASURY_USER_ID for improved financial operations during product sales. 2025-12-10 12:57:08 +01:00
Torsten Schulz (local)
433259da74 Refactor WeatherWorker: Improve weather update query to ensure unique random weather selection for each region using LATERAL join. 2025-12-09 13:51:02 +01:00
Torsten Schulz (local)
cddf701af1 Refactor change_falukant_user_money: Remove debug logging for money clamping and update execution to reduce noise, maintaining essential logging only when clipping occurs. 2025-12-09 10:35:33 +01:00
Torsten Schulz (local)
c801e50def Enhance money history tracking: Implement best-effort creation of money_history table in BaseWorker, EventsWorker, and UndergroundWorker to ensure logging of monetary changes without operation failure. 2025-12-09 08:53:39 +01:00
Torsten Schulz (local)
d740dbbf73 Enhance money history logging: Implement best-effort insert into money_history for UI visibility across BaseWorker, EventsWorker, and UndergroundWorker, improving tracking of monetary changes. 2025-12-09 08:19:42 +01:00
Torsten Schulz (local)
e8c8c5edb1 Refactor EventsWorker: Move EVENT_RATE_SCALE constant to the struct for better encapsulation and clarity in event probability calculations. 2025-12-09 00:09:12 +01:00
Torsten Schulz (local)
a4d1d79e6e Enhance EventsWorker: Introduce EVENT_RATE_SCALE constant to adjust event frequency, improving control over event triggering rates. 2025-12-09 00:07:55 +01:00
Torsten Schulz (local)
78b5527b15 Enhance change_falukant_user_money: Switch to literal SQL execution for update_money to resolve serialization issues with parameterized calls, improving reliability. 2025-12-08 16:39:57 +01:00
Torsten Schulz (local)
180431b130 Enhance change_falukant_user_money: Implement money clamping logic to ensure updates stay within numeric(10,2) limits, improving data integrity and error handling. 2025-12-08 16:34:57 +01:00
Torsten Schulz (local)
99fbaab816 Enhance change_falukant_user_money: Implement fallback to literal SQL for update_money on failure of parameterized call, improving robustness and error handling. 2025-12-08 16:28:46 +01:00
Torsten Schulz (local)
450497ccd3 Refactor change_falukant_user_money: Update parameter types for database call and enhance logging for better traceability 2025-12-08 16:23:24 +01:00
Torsten Schulz (local)
04a8da8d0c Enhance logging in change_falukant_user_money: Added type logging for parameters to identify unexpected types during execution, improving debugging capabilities. 2025-12-08 16:15:30 +01:00
Torsten Schulz (local)
688b21581d Enhance logging in BaseWorker and DirectorWorker: Added detailed debug logs before database calls in change_falukant_user_money, improving traceability of user ID and money change values during production start and sell operations. 2025-12-08 16:07:08 +01:00
Torsten Schulz (local)
f7c4919a2a Enhance error logging in change_falukant_user_money function: Added detailed logging for parameters before executing the database update and improved error handling for serialization issues, enhancing traceability and debugging capabilities. 2025-12-08 16:01:25 +01:00
Torsten Schulz (local)
ad0033031d Validate money change input in update_money function: Added checks to ensure the money_change value is finite before executing the database update, preventing potential serialization errors with invalid values. 2025-12-08 15:53:31 +01:00
Torsten Schulz (local)
b4b3b1adcc Enhance user notification structure in EventsWorker: Updated the notification process to include detailed event information in the database entries. Notifications now contain event ID, type, and effects, improving clarity and data integrity for user alerts. 2025-12-08 13:29:18 +01:00
Torsten Schulz (local)
9b6883ea84 Implement inheritance logic for player characters in EventsWorker: Added functionality to handle character inheritance before deleting child relations. This includes querying for the user ID, determining the heir, and updating the heir's assets accordingly. Enhanced logging for inheritance events to improve traceability. 2025-12-08 13:22:20 +01:00
Torsten Schulz (local)
d078b6b19a Refactor WebSocket user ID filtering and enhance SQL query security: Updated user ID handling in the WebSocket server to improve filtering logic for numeric user IDs. Implemented parameterized queries in the database operations across multiple worker files to prevent SQL injection vulnerabilities, ensuring safer data handling. 2025-12-08 11:56:04 +01:00
Torsten Schulz (local)
2948586041 Enhance event effect handling in EventsWorker: Updated money change, storage capacity change, and house quality change methods to return absolute values and percentages. Improved JSON response structure for event effects, enhancing clarity and data accuracy in event processing. 2025-12-08 11:51:10 +01:00
Torsten Schulz (local)
0198bcd603 Enhance user notification handling in EventsWorker: Updated the notification process to write user notifications to the database and send WebSocket alerts for each affected user in a region. Improved logging to reflect the number of users notified during regional event processing. 2025-12-08 11:34:20 +01:00
Torsten Schulz (local)
37b2c08555 Add new event effects and implement regional changes: Introduced HouseQualityChange and updated StorageCapacityChange effects in EventsWorker. Implemented regional handling for storage capacity and house quality changes during events, enhancing gameplay dynamics and event impact. Improved logging for affected stocks and houses during changes. 2025-12-08 11:23:34 +01:00
Torsten Schulz (local)
5a3a818d84 Add EventsWorker to worker module: Introduced EventsWorker for handling event-related tasks. Updated main.rs to include EventsWorker in the worker creation process. Adjusted WeatherWorker instantiation to use cloned pool and broker for consistency. 2025-12-08 11:17:16 +01:00
Torsten Schulz (local)
8db82e0ced Refactor transport planning in DirectorWorker: Updated variable naming for clarity by changing 'shipped' to '_shipped' to indicate unused variable. Removed unused get_branch_user_id function from TransportWorker to streamline code and improve maintainability. 2025-12-05 14:20:56 +01:00
Torsten Schulz (local)
f481ef4b73 Refactor inventory handling in DirectorWorker: Updated transport planning logic to ensure inventory is reduced immediately after successful transport creation. Removed redundant inventory updates from the planning phase, enhancing consistency and clarity in inventory management. Improved logging to reflect changes in inventory status during transport operations. 2025-12-05 14:17:57 +01:00
Torsten Schulz (local)
d03d865f75 Refactor ArrivedTransport struct and SQL query in TransportWorker: Updated the ArrivedTransport struct to include source and target branch IDs, and user ID for notifications. Modified the SQL query to join with source and target branches, enhancing transport data retrieval and notification capabilities. 2025-12-05 14:15:22 +01:00
Torsten Schulz (local)
58436bc016 Enhance transport processing in TransportWorker: Updated run_loop and process_arrived_transports methods to include broker for publishing notifications. Improved handling of empty transports and added notifications for transport arrival and inventory updates, ensuring timely user alerts and better transport management. 2025-12-05 14:12:17 +01:00
Torsten Schulz (local)
fbcea09257 Refactor transport handling in TransportWorker: Updated ArrivedTransport struct to allow optional product_id for empty transports. Enhanced validation logic to differentiate between normal and empty transports, improving handling and processing of transport data. Added specific handling for empty transports in the database operations, ensuring accurate vehicle updates and transport deletions. 2025-12-05 14:06:22 +01:00
Torsten Schulz (local)
46d0ea46a8 Refactor weather update query in WeatherWorker: Simplified the SQL logic for assigning random weather types to regions by removing unnecessary joins and using a subquery for random selection. Enhanced comments for clarity on the individual weather assignment process for each region. 2025-12-05 13:36:55 +01:00
Torsten Schulz (local)
b59837feb3 Refactor transport planning logic in DirectorWorker: Improved handling of empty transports for vehicle retrieval when no vehicles are available in the current branch. Enhanced checks for free vehicles and better selling prices in other branches, along with detailed logging for improved traceability during transport operations. 2025-12-05 12:56:59 +01:00
Torsten Schulz (local)
9f2f20cba2 Add empty transport planning in DirectorWorker: Introduced SQL queries and logic to handle empty transports for vehicle retrieval when no transport vehicles are available in the current branch. Enhanced the planning process to check for better selling prices in other branches and available free vehicles, improving transport management and operational efficiency. 2025-12-04 16:31:39 +01:00
Torsten Schulz (local)
940706bed3 Enhance logging and vehicle checks in DirectorWorker: Added SQL queries to verify the existence of vehicles in the source region and routes between regions. Improved debug logging to provide insights into vehicle counts and route availability, enhancing traceability during transport planning operations. 2025-12-03 16:54:22 +01:00
Torsten Schulz (local)
66b19fbe7c Enhance logging in DirectorWorker for transport planning: Added detailed error and status messages throughout the transport planning process, including inventory checks, transport feasibility assessments, and pricing evaluations. This improves traceability and debugging capabilities for transport operations associated with directors. 2025-12-03 16:52:38 +01:00
Torsten Schulz (local)
d2c8b62156 Implement transport management in DirectorWorker: Enhanced the start_transports_stub function to handle transport planning for inventory items associated with a director. Added error handling for transport initiation and improved database interactions for inventory management, ensuring accurate transport planning and logging of potential errors. 2025-12-03 16:42:36 +01:00
Torsten Schulz (local)
e14272e477 Add WeatherWorker to the worker module and update worker creation logic: Introduced WeatherWorker to manage weather-related tasks. Updated the create_workers function to include WeatherWorker alongside existing workers, ensuring comprehensive handling of various operational aspects. 2025-12-02 12:59:40 +01:00
Torsten Schulz (local)
c943e57f80 Enhance production management by adding region_id to ProductionPlan and updating SQL queries: Introduced region_id to the ProductionPlan struct and modified the insert production query to include weather_type_id based on region. Updated finished productions query to account for weather effects on quality ratings, ensuring accurate production assessments. Improved comments for clarity on the impact of weather on production quality. 2025-12-02 09:57:31 +01:00
Torsten Schulz (local)
32dd79bc6e Refactor hourly price recalculation logic: Implemented a two-tier pricing adjustment system based on sales data, comparing city sales against global and parent-region averages. Updated SQL queries to reflect new pricing rules, ensuring dynamic price adjustments within defined tolerances. Enhanced logging for better tracking of affected regions during recalculation. 2025-12-02 09:29:33 +01:00
Torsten Schulz (local)
4a2e814803 Enhance pricing logic in DirectorWorker and implement hourly price recalculation: Added a new worth_percent field to the InventoryItem struct and updated SQL queries to incorporate this value in price calculations. Refactored price computation logic to use a base price derived from worth_percent. Introduced a new hourly price recalculation mechanism that adjusts prices based on sales data from the last hour, ensuring dynamic pricing adjustments. Enhanced logging for better monitoring of price updates. 2025-12-02 08:55:01 +01:00
Torsten Schulz (local)
9ee8c970c7 Add branch capacity query and production limits in DirectorWorker: Introduced a new SQL query to fetch current stock and production values for a branch, enabling dynamic production management. Implemented logic to limit concurrent productions to a maximum of two and updated production creation to handle single production requests efficiently. Enhanced logging for better traceability of production activities. 2025-12-01 16:23:40 +01:00