fix upgrade code

This commit is contained in:
Damien Elmes 2009-02-08 04:36:27 +09:00
parent 9b4da171fe
commit fa1713e9ee

View file

@ -2495,18 +2495,25 @@ where interval < 1""")
for (id, tags) in rows: for (id, tags) in rows:
d.append({ d.append({
'i': id, 'i': id,
't': joinTags( 't': joinTags(sorted(
[t.strip().replace(" ", "-") for t in [t.strip().replace(" ", "-") for t in
tags.split(",") if t.strip()]), tags.split(",") if t.strip()])),
'tt': time.time(),
}) })
deck.s.statements( deck.s.statements(
"update facts set tags = :t, modified = :tt where id = :i", d) "update facts set tags = :t where id = :i", d)
deck.highPriority = deck.highPriority.replace(" ", "-")
deck.medPriority = deck.medPriority.replace(" ", "-")
deck.lowPriority = deck.lowPriority.replace(" ", "-")
deck.suspended = deck.suspended.replace(" ", "-")
deck.highPriority = deck.highPriority.replace(",", " ")
deck.medPriority = deck.medPriority.replace(",", " ")
deck.lowPriority = deck.lowPriority.replace(",", " ")
deck.suspended = deck.suspended.replace(",", " ")
for m in deck.models: for m in deck.models:
for cm in m.cardModels: for cm in m.cardModels:
cm.name = cm.name.replace(" ", "-") cm.name = cm.name.replace(" ", "-")
m.tags = m.tags.replace(" ", "-") m.tags = re.sub(", ?", " ", m.tags)
m.setModified() m.tags = canonifyTags(m.tags)
deck.updateCardsFromModel(m, dirty=False) deck.updateCardsFromModel(m, dirty=False)
deck.version = 26 deck.version = 26
deck.s.commit() deck.s.commit()