mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
Results: Fix db update.
This commit is contained in:
1 parent
8744e1d73e
commit
f516db0e48
2 files changed
+19
-4
No files matched your search
@@ -116,10 +116,16 @@ class Results(SQLSubModel):
|
||||
@classmethod
|
||||
def _db_update(cls, execute, version, data=None):
|
||||
major, minor, release = version.strip().split(".")
|
||||
create = False
|
||||
|
||||
if major == "0" and int(minor) <= 2:
|
||||
if int(release) < 1:
|
||||
if major == "0" and int(minor) < 2:
|
||||
cls._db_create(execute)
|
||||
create = True
|
||||
|
||||
if major == "0" and int(minor) == 2:
|
||||
if int(release) < 1 and not create:
|
||||
cls._db_create(execute)
|
||||
create = True
|
||||
|
||||
return cls._update_submodel(execute, version, data)
|
||||
|
||||
@@ -139,6 +145,9 @@ class Results(SQLSubModel):
|
||||
f"WHERE scenario = {scenario.id}"
|
||||
)
|
||||
|
||||
if table is None:
|
||||
yield new
|
||||
|
||||
if len(table) > 1:
|
||||
logger.warning("Multiple results for this scenario")
|
||||
|
||||
|
||||
@@ -105,10 +105,16 @@ class Profile(SQLSubModel):
|
||||
@classmethod
|
||||
def _db_update(cls, execute, version, data=None):
|
||||
major, minor, release = version.strip().split(".")
|
||||
create = False
|
||||
|
||||
if major == "0" and int(minor) <= 2:
|
||||
if int(release) < 1:
|
||||
if major == "0" and int(minor) < 2:
|
||||
cls._db_create(execute)
|
||||
create = True
|
||||
|
||||
if major == "0" and int(minor) == 2:
|
||||
if int(release) < 1 and not create:
|
||||
cls._db_create(execute)
|
||||
create = True
|
||||
|
||||
return cls._update_submodel(execute, version, data)
|
||||
|
||||
|
||||
Reference in new issue
Block a user