Detecte et supprime doublons dans les préférences
This commit is contained in:
parent
66d443944a
commit
5268ea4f13
@ -1949,6 +1949,15 @@ class BasePreferences(object):
|
|||||||
"name": name,
|
"name": name,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
if len(pdb) > 1:
|
||||||
|
# suppress buggy duplicates (may come from corrupted database for ice ages)
|
||||||
|
log(
|
||||||
|
f"**oups** detected duplicated preference !\n({self.dept_id}, {formsemestre_id}, {name}, {value})"
|
||||||
|
)
|
||||||
|
for obj in pdb[1:]:
|
||||||
|
self._editor.delete(cnx, obj["id"])
|
||||||
|
pdb = [pdb[0]]
|
||||||
|
|
||||||
if not pdb:
|
if not pdb:
|
||||||
# crée préférence
|
# crée préférence
|
||||||
log("create pref sem=%s %s=%s" % (formsemestre_id, name, value))
|
log("create pref sem=%s %s=%s" % (formsemestre_id, name, value))
|
||||||
@ -1962,10 +1971,8 @@ class BasePreferences(object):
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
modif = True
|
modif = True
|
||||||
log("create pref sem=%s %s=%s" % (formsemestre_id, name, value))
|
|
||||||
else:
|
else:
|
||||||
# edit existing value
|
# edit existing value
|
||||||
|
|
||||||
existing_value = pdb[0]["value"] # old stored value
|
existing_value = pdb[0]["value"] # old stored value
|
||||||
if (
|
if (
|
||||||
(existing_value != value)
|
(existing_value != value)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# -*- mode: python -*-
|
# -*- mode: python -*-
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
SCOVERSION = "9.0.55"
|
SCOVERSION = "9.0.56"
|
||||||
|
|
||||||
SCONAME = "ScoDoc"
|
SCONAME = "ScoDoc"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user