Commit 236ab152 authored by Marco Schmiedel's avatar Marco Schmiedel

fix

parent beb8700e
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
"fileId": "01509001-bd4e-4462-93ad-dc5066fd729a", "fileId": "01509001-bd4e-4462-93ad-dc5066fd729a",
"originalPath": "work/models/deal_deal.py", "originalPath": "work/models/deal_deal.py",
"currentPath": "work/models/deal_deal.py", "currentPath": "work/models/deal_deal.py",
"hash": "f98ec3d5e7fa72f4907d6079628bf18a610e5229aca15ea7bfdca1008370f090", "hash": "40213041f5335d16b58dfc6a335038f521462e1985a09402f11c9b7c7fcdc031",
"docContent": "<p><br></p>", "docContent": "<p><br></p>",
"checkedStatus": "done", "checkedStatus": "done",
"comments": [], "comments": [],
"lastCheckedTimestamp": 1746694069667, "lastCheckedTimestamp": 1750323591197,
"lastFileModificationTimestamp": 1746694022329.5034, "lastFileModificationTimestamp": 1750322900297.3425,
"flaggedForCopy": false "flaggedForCopy": false
} }
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
"fileId": "0c371de0-5973-4ab4-928c-cf5415012cc8", "fileId": "0c371de0-5973-4ab4-928c-cf5415012cc8",
"originalPath": "work/commands/setStaticOptionPrices.py", "originalPath": "work/commands/setStaticOptionPrices.py",
"currentPath": "work/commands/setStaticOptionPrices.py", "currentPath": "work/commands/setStaticOptionPrices.py",
"hash": "ff9c898694ab65f87e613dcac0ab20c4565335db25c2656bed573d103ad2c694", "hash": "e6128d9a59cf3b14986ec7a96cf891e67dd77e7b50029fe6321f7625b32bd0b7",
"docContent": "<p><br></p>", "docContent": "<p><br></p>",
"checkedStatus": "todo", "checkedStatus": "done",
"comments": [], "comments": [],
"lastCheckedTimestamp": 1749816832953, "lastCheckedTimestamp": 1750323678836,
"lastFileModificationTimestamp": 1749816769839.5076 "lastFileModificationTimestamp": 1750323672008.4895
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"fileId": "36e791b4-e235-42f6-ac61-8560f1762892", "fileId": "36e791b4-e235-42f6-ac61-8560f1762892",
"originalPath": "work/workbench/Workbench.mwb", "originalPath": "work/workbench/Workbench.mwb",
"currentPath": "work/workbench/Workbench.mwb", "currentPath": "work/workbench/Workbench.mwb",
"hash": "afea3df7165b4dad78d5a9d92ede4fec601f68ed0a14147532cf1ca00617c29e", "hash": "66d7321a70d23c6704bde73d00b3102358f5942df6617b1c1f83a0d1e56d322b",
"docContent": "<p><br></p>", "docContent": "<p><br></p>",
"checkedStatus": "done", "checkedStatus": "done",
"comments": [ "comments": [
...@@ -12,6 +12,6 @@ ...@@ -12,6 +12,6 @@
"timestamp": 1746693753181 "timestamp": 1746693753181
} }
], ],
"lastCheckedTimestamp": 1747070021483, "lastCheckedTimestamp": 1750328592721,
"lastFileModificationTimestamp": 1747068819870.2563 "lastFileModificationTimestamp": 1750322693600.0522
} }
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
"fileId": "38b9eebe-955e-4052-a0f6-29c69b1242b3", "fileId": "38b9eebe-955e-4052-a0f6-29c69b1242b3",
"originalPath": "work/config/MysqlConfig.py", "originalPath": "work/config/MysqlConfig.py",
"currentPath": "work/config/MysqlConfig.py", "currentPath": "work/config/MysqlConfig.py",
"hash": "d8958dba0bf7c100587dabf6ff576e0a1905a0aed4980a6c64ff6254f3671e5a", "hash": "a6de5ed4cb42c8208047b4466357bde2952886430465dbff6097f02d8e886d7c",
"docContent": "<p><br></p>", "docContent": "<p><br></p>",
"checkedStatus": "changed", "checkedStatus": "todo",
"comments": [ "comments": [
{ {
"commentId": "56c5adba-20f4-4524-a894-41f81ab7ca55", "commentId": "56c5adba-20f4-4524-a894-41f81ab7ca55",
...@@ -12,6 +12,6 @@ ...@@ -12,6 +12,6 @@
"timestamp": 1744622354948 "timestamp": 1744622354948
} }
], ],
"lastCheckedTimestamp": 1747123619645, "lastCheckedTimestamp": 1750328615978,
"lastFileModificationTimestamp": 1749816529644.1785 "lastFileModificationTimestamp": 1750328609835.271
} }
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
"fileId": "5f874bee-40e2-4b9a-b102-f0b6d643a840", "fileId": "5f874bee-40e2-4b9a-b102-f0b6d643a840",
"originalPath": "work/commands/downloadDataFromMaui.py", "originalPath": "work/commands/downloadDataFromMaui.py",
"currentPath": "work/commands/downloadDataFromMaui.py", "currentPath": "work/commands/downloadDataFromMaui.py",
"hash": "f75e0013a123055434a4592bb3509d3ff298273727226ef431662f3fad739fad", "hash": "7bf05e24539e6b6cc9b9abf1c3103aee2e4419c1dd5c2a8fadd2d825947b951f",
"docContent": "<p><br></p>", "docContent": "<p><br></p>",
"checkedStatus": "done", "checkedStatus": "done",
"comments": [], "comments": [],
"lastCheckedTimestamp": 1747071242419, "lastCheckedTimestamp": 1750323681845,
"lastFileModificationTimestamp": 1747071185164.952 "lastFileModificationTimestamp": 1750323366660.076
} }
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
"fileId": "e146d34c-9d63-4ea0-b8b8-5f8d503f34f6", "fileId": "e146d34c-9d63-4ea0-b8b8-5f8d503f34f6",
"originalPath": "work/models/option_opti.py", "originalPath": "work/models/option_opti.py",
"currentPath": "work/models/option_opti.py", "currentPath": "work/models/option_opti.py",
"hash": "389c9070a2271f186f35fac6f51490b3ec7b5a4483b0769af7309b36aac0a163", "hash": "af00a2687f2ac9ea0285e96ec70320ea2a3bf3ed4359b2850b1b1273c236e7ce",
"docContent": "<p><br></p>", "docContent": "<p><br></p>",
"checkedStatus": "done", "checkedStatus": "done",
"comments": [], "comments": [],
"lastCheckedTimestamp": 1746694066635, "lastCheckedTimestamp": 1750323587708,
"lastFileModificationTimestamp": 1746694007962.1345, "lastFileModificationTimestamp": 1750322895612.6667,
"flaggedForCopy": false "flaggedForCopy": false
} }
...@@ -261,8 +261,8 @@ def scrapeData(seleniumManager): ...@@ -261,8 +261,8 @@ def scrapeData(seleniumManager):
# This variable holds the Selenium driver instance. # This variable holds the Selenium driver instance.
seleniumDriver = seleniumManager.driver seleniumDriver = seleniumManager.driver
# This variable is a WebDriverWait object with a 20-second timeout. # This variable is a WebDriverWait object with a 60-second timeout.
wait = WebDriverWait(seleniumDriver, 20) wait = WebDriverWait(seleniumDriver, 60)
# This variable defines the path for the cache directory. # This variable defines the path for the cache directory.
cacheDir = "../cache" cacheDir = "../cache"
......
...@@ -4,21 +4,22 @@ import logging ...@@ -4,21 +4,22 @@ import logging
from sqlalchemy import text from sqlalchemy import text
from manager.MysqlManager import MysqlManager from manager.MysqlManager import MysqlManager
# Logging-Konfiguration wie in deiner Vorlage für klare Statusmeldungen. # Logging configuration as in your template for clear status messages.
logging.basicConfig( logging.basicConfig(
level=logging.INFO, level=logging.INFO,
format="%(asctime)s %(levelname)s: %(message)s" format="%(asctime)s %(levelname)s: %(message)s"
) )
# Liste aller statischen SQL-Update-Befehle, die ausgeführt werden sollen. # List of all static SQL update commands to be executed.
# Die Bedingung "and provision1_opti = 0" stellt sicher, dass jeder Befehl # The condition "and provision1_opti = 0" ensures that each command
# nur einmal erfolgreich ausgeführt wird. # is executed successfully only once.
sql_updates = [ sql_updates = [
# Kategorie 1: Rabatte auf den Anschlusspreis
# Category 1: Discounts on the connection fee
'update option_opti set provision1_opti = -8 where providercode_opti = "O3150922" and provision1_opti = 0;', 'update option_opti set provision1_opti = -8 where providercode_opti = "O3150922" and provision1_opti = 0;',
'update option_opti set provision1_opti = -33.61 where providercode_opti = "O3150921" and provision1_opti = 0;', 'update option_opti set provision1_opti = -33.61 where providercode_opti = "O3150921" and provision1_opti = 0;',
# Kategorie 2: Aktionsguthaben # Category 2: Promotional credit
'update option_opti set provision1_opti = -20.17 where providercode_opti = "O3120740" and provision1_opti = 0;', 'update option_opti set provision1_opti = -20.17 where providercode_opti = "O3120740" and provision1_opti = 0;',
'update option_opti set provision1_opti = -20.17 where providercode_opti = "O3120741" and provision1_opti = 0;', 'update option_opti set provision1_opti = -20.17 where providercode_opti = "O3120741" and provision1_opti = 0;',
'update option_opti set provision1_opti = -40.34 where providercode_opti = "O3120743" and provision1_opti = 0;', 'update option_opti set provision1_opti = -40.34 where providercode_opti = "O3120743" and provision1_opti = 0;',
...@@ -42,7 +43,7 @@ sql_updates = [ ...@@ -42,7 +43,7 @@ sql_updates = [
'update option_opti set provision1_opti = -201.68 where providercode_opti = "O3120759" and provision1_opti = 0;', 'update option_opti set provision1_opti = -201.68 where providercode_opti = "O3120759" and provision1_opti = 0;',
'update option_opti set provision1_opti = -201.68 where providercode_opti = "O3120760" and provision1_opti = 0;', 'update option_opti set provision1_opti = -201.68 where providercode_opti = "O3120760" and provision1_opti = 0;',
# Kategorie 3: Tarif-Rabatte # Category 3: Tariff discounts
'UPDATE option_opti SET provision1_opti = -20 WHERE providercode_opti = "O3357017" AND provision1_opti = 0;', 'UPDATE option_opti SET provision1_opti = -20 WHERE providercode_opti = "O3357017" AND provision1_opti = 0;',
'UPDATE option_opti SET provision1_opti = -40 WHERE providercode_opti = "O3357018" AND provision1_opti = 0;', 'UPDATE option_opti SET provision1_opti = -40 WHERE providercode_opti = "O3357018" AND provision1_opti = 0;',
'UPDATE option_opti SET provision1_opti = -40 WHERE providercode_opti = "O3708586" AND provision1_opti = 0;', 'UPDATE option_opti SET provision1_opti = -40 WHERE providercode_opti = "O3708586" AND provision1_opti = 0;',
...@@ -64,7 +65,7 @@ sql_updates = [ ...@@ -64,7 +65,7 @@ sql_updates = [
'UPDATE option_opti SET provision1_opti = -240 WHERE providercode_opti = "O3708574" AND provision1_opti = 0;', 'UPDATE option_opti SET provision1_opti = -240 WHERE providercode_opti = "O3708574" AND provision1_opti = 0;',
'UPDATE option_opti SET provision1_opti = -240 WHERE providercode_opti = "O3708544" AND provision1_opti = 0;', 'UPDATE option_opti SET provision1_opti = -240 WHERE providercode_opti = "O3708544" AND provision1_opti = 0;',
# Kategorie 4: Cashback # Category 4: Cashback
'UPDATE option_opti SET provision1_opti = -35 WHERE providercode_opti = "O3501314" AND provision1_opti = 0;', 'UPDATE option_opti SET provision1_opti = -35 WHERE providercode_opti = "O3501314" AND provision1_opti = 0;',
'UPDATE option_opti SET provision1_opti = -45 WHERE providercode_opti = "O3501311" AND provision1_opti = 0;', 'UPDATE option_opti SET provision1_opti = -45 WHERE providercode_opti = "O3501311" AND provision1_opti = 0;',
'UPDATE option_opti SET provision1_opti = -75 WHERE providercode_opti = "O3501308" AND provision1_opti = 0;', 'UPDATE option_opti SET provision1_opti = -75 WHERE providercode_opti = "O3501308" AND provision1_opti = 0;',
...@@ -72,39 +73,42 @@ sql_updates = [ ...@@ -72,39 +73,42 @@ sql_updates = [
] ]
# Die Variable “mysql” stellt die Verbindung zur Datenbank her. # The "mysql" variable establishes the connection to the database.
mysql = MysqlManager() mysql = MysqlManager()
# Die Variable “session” holt die SQLAlchemy-Session für alle Datenbankoperationen. # The "session" variable retrieves the SQLAlchemy session for all database operations.
session = mysql.getSession() session = mysql.getSession()
logging.info("Starte statische Provisions-Updates...") logging.info("Starting static provision updates...")
updated_count = 0 updated_count = 0
total_count = len(sql_updates) total_count = len(sql_updates)
try: try:
# Schleife durch alle SQL-Befehle und führe sie einzeln aus. # Loop through all SQL commands and execute them one by one.
for i, query in enumerate(sql_updates): for i, query in enumerate(sql_updates):
# session.execute() mit text() ist der Standardweg, um Raw SQL sicher auszuführen.
# session.execute() with text() is the standard way to safely execute raw SQL.
result = session.execute(text(query)) result = session.execute(text(query))
# result.rowcount gibt an, wie viele Zeilen vom UPDATE betroffen waren. # result.rowcount indicates how many rows were affected by the UPDATE.
# Dies ist nützlich für das Logging, um zu sehen, ob eine Änderung stattgefunden hat. # This is useful for logging to see if a change has occurred.
if result.rowcount > 0: if result.rowcount > 0:
updated_count += result.rowcount updated_count += result.rowcount
logging.info(f"Query {i+1}/{total_count}: {result.rowcount} Zeile(n) aktualisiert.") logging.info(f"Query {i+1}/{total_count}: {result.rowcount} row(s) updated.")
# Wenn alle Befehle ohne Fehler durchgelaufen sind, werden die Änderungen committed. # If all commands have run without error, the changes are committed.
session.commit() session.commit()
logging.info(f"Alle {total_count} Updates erfolgreich verarbeitet. Insgesamt wurden {updated_count} Zeilen geändert.") logging.info(f"All {total_count} updates processed successfully. A total of {updated_count} rows were changed.")
except Exception as e: except Exception as e:
# Bei einem Fehler wird die gesamte Transaktion zurückgerollt, um inkonsistente Daten zu vermeiden.
logging.error(f"Ein Fehler ist aufgetreten: {e}") # In case of an error, the entire transaction is rolled back to avoid inconsistent data.
logging.error("Die Transaktion wird zurückgerollt (Rollback).") logging.error(f"An error occurred: {e}")
logging.error("The transaction is being rolled back.")
session.rollback() session.rollback()
finally: finally:
# Die Session wird in jedem Fall geschlossen, um die Verbindung freizugeben.
# The session is closed in any case to release the connection.
session.close() session.close()
logging.info("Datenbank-Session geschlossen.") logging.info("Database session closed.")
\ No newline at end of file \ No newline at end of file
from sqlalchemy import Column, Integer, String, Numeric, DateTime, ForeignKey from sqlalchemy import Column, Integer, String, Numeric, DateTime, ForeignKey
from sqlalchemy.orm import relationship from sqlalchemy.orm import relationship
from models._system import Base from models._system import Base
from models.provisiongroup_pgro import ProvisiongroupPgro
class DealDeal(Base): class DealDeal(Base):
...@@ -13,10 +12,6 @@ class DealDeal(Base): ...@@ -13,10 +12,6 @@ class DealDeal(Base):
primary_key=True, primary_key=True,
autoincrement=True autoincrement=True
) )
provisiongroup_deal = Column(
Integer,
ForeignKey('provisiongroup_pgro.id_pgro')
)
base_deal = Column( base_deal = Column(
Integer, Integer,
ForeignKey('base_base.id_base'), ForeignKey('base_base.id_base'),
...@@ -75,7 +70,3 @@ class DealDeal(Base): ...@@ -75,7 +70,3 @@ class DealDeal(Base):
"BaseBase", "BaseBase",
back_populates="deals" back_populates="deals"
) )
provisiongroup = relationship(
"ProvisiongroupPgro",
back_populates="deals"
)
from sqlalchemy import Column, Integer, String, Numeric, DateTime, ForeignKey from sqlalchemy import Column, Integer, String, Numeric, DateTime, ForeignKey
from sqlalchemy.orm import relationship from sqlalchemy.orm import relationship
from models._system import Base from models._system import Base
from models.provisiongroup_pgro import ProvisiongroupPgro
class OptionOpti(Base): class OptionOpti(Base):
...@@ -13,10 +12,6 @@ class OptionOpti(Base): ...@@ -13,10 +12,6 @@ class OptionOpti(Base):
primary_key=True, primary_key=True,
autoincrement=True autoincrement=True
) )
provisiongroup_opti = Column(
Integer,
ForeignKey('provisiongroup_pgro.id_pgro')
)
base_opti = Column( base_opti = Column(
Integer, Integer,
ForeignKey('base_base.id_base'), ForeignKey('base_base.id_base'),
...@@ -79,7 +74,3 @@ class OptionOpti(Base): ...@@ -79,7 +74,3 @@ class OptionOpti(Base):
"BaseBase", "BaseBase",
back_populates="options" back_populates="options"
) )
provisiongroup = relationship(
"ProvisiongroupPgro",
back_populates="options"
)
from sqlalchemy import Column, Integer, String, Numeric, DateTime
from sqlalchemy.orm import relationship
from models._system import Base
class ProvisiongroupPgro(Base):
__tablename__ = 'provisiongroup_pgro'
id_pgro = Column(
Integer,
primary_key=True,
autoincrement=True
)
name_pgro = Column(
String(255),
nullable=False
)
percent_pgro = Column(
Numeric(5, 2),
nullable=False,
default=0.00
)
created_pgro = Column(
DateTime,
nullable=False
)
updated_pgro = Column(
DateTime,
nullable=True
)
deals = relationship(
"DealDeal",
back_populates="provisiongroup"
)
options = relationship(
"OptionOpti",
back_populates="provisiongroup"
)
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment