|
@ -19,7 +19,7 @@ def merge_props(r1, r2, prop, pretend=True, smaller=False, equal=True): |
|
|
r1.__setattr__(prop, a2) |
|
|
r1.__setattr__(prop, a2) |
|
|
elif a2: |
|
|
elif a2: |
|
|
if equal and a1 != a2: |
|
|
if equal and a1 != a2: |
|
|
log.warn(u"merge: Ruzna %s: %s VS %s", prop, a1, a2) |
|
|
log.warn("merge: Ruzna %s: %s VS %s", prop, a1, a2) |
|
|
if smaller: |
|
|
if smaller: |
|
|
if not pretend: |
|
|
if not pretend: |
|
|
r1.__setattr__(prop, min(a1, a2)) |
|
|
r1.__setattr__(prop, min(a1, a2)) |
|
@ -33,16 +33,16 @@ def merge_Resitel(rbase, rmerge, pretend=True): |
|
|
# Ma relace: skola |
|
|
# Ma relace: skola |
|
|
# Je v relaci: user, reseni, soustredeni_ucastnici, vysledky_base(VIEW) |
|
|
# Je v relaci: user, reseni, soustredeni_ucastnici, vysledky_base(VIEW) |
|
|
|
|
|
|
|
|
log.info(u"merge: %s <- %s", unicode(rbase), unicode(rmerge)) |
|
|
log.info("merge: %s <- %s", unicode(rbase), unicode(rmerge)) |
|
|
|
|
|
|
|
|
assert not rbase.user |
|
|
assert not rbase.user |
|
|
assert not rmerge.user |
|
|
assert not rmerge.user |
|
|
assert rbase != rmerge |
|
|
assert rbase != rmerge |
|
|
|
|
|
|
|
|
if (rbase.jmeno != rmerge.jmeno) or (rbase.prijmeni != rmerge.prijmeni): |
|
|
if (rbase.jmeno != rmerge.jmeno) or (rbase.prijmeni != rmerge.prijmeni): |
|
|
log.error(u"merge: Ruzna jmena: %s VS %s", rbase, rmerge) |
|
|
log.error("merge: Ruzna jmena: %s VS %s", rbase, rmerge) |
|
|
if rbase.rok_maturity != rmerge.rok_maturity: |
|
|
if rbase.rok_maturity != rmerge.rok_maturity: |
|
|
log.error(u"merge: Ruzne roky maturity: %s VS %s", rbase.rok_maturity, rmerge.rok_maturity) |
|
|
log.error("merge: Ruzne roky maturity: %s VS %s", rbase.rok_maturity, rmerge.rok_maturity) |
|
|
|
|
|
|
|
|
with reversion.create_revision(): |
|
|
with reversion.create_revision(): |
|
|
reversion.set_comment('Merge duplicitnich Resitelu: %r <- %r' % (rbase.pk, rmerge.pk)) |
|
|
reversion.set_comment('Merge duplicitnich Resitelu: %r <- %r' % (rbase.pk, rmerge.pk)) |
|
|