forked from ScoDoc/DocScoDoc
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,
|
||||
},
|
||||
)
|
||||
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:
|
||||
# crée préférence
|
||||
log("create pref sem=%s %s=%s" % (formsemestre_id, name, value))
|
||||
@ -1962,10 +1971,8 @@ class BasePreferences(object):
|
||||
},
|
||||
)
|
||||
modif = True
|
||||
log("create pref sem=%s %s=%s" % (formsemestre_id, name, value))
|
||||
else:
|
||||
# edit existing value
|
||||
|
||||
existing_value = pdb[0]["value"] # old stored value
|
||||
if (
|
||||
(existing_value != value)
|
||||
|
@ -1,7 +1,7 @@
|
||||
# -*- mode: python -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
SCOVERSION = "9.0.55"
|
||||
SCOVERSION = "9.0.56"
|
||||
|
||||
SCONAME = "ScoDoc"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user