mirror of
https://github.com/ankitects/anki.git
synced 2025-09-25 01:06:35 -04:00
make sure to export deck creation date on apkg export
This commit is contained in:
parent
875a417346
commit
4f8053b165
2 changed files with 32 additions and 0 deletions
|
@ -193,6 +193,7 @@ class AnkiExporter(Exporter):
|
||||||
for file in self.src.media.filesInStr(mid, flds):
|
for file in self.src.media.filesInStr(mid, flds):
|
||||||
media[file] = True
|
media[file] = True
|
||||||
self.mediaFiles = media.keys()
|
self.mediaFiles = media.keys()
|
||||||
|
self.dst.crt = self.src.crt
|
||||||
# todo: tags?
|
# todo: tags?
|
||||||
self.count = self.dst.cardCount()
|
self.count = self.dst.cardCount()
|
||||||
self.dst.setMod()
|
self.dst.setMod()
|
||||||
|
|
|
@ -4,6 +4,7 @@ import nose, os, tempfile
|
||||||
import anki
|
import anki
|
||||||
from anki import Collection as aopen
|
from anki import Collection as aopen
|
||||||
from anki.exporting import *
|
from anki.exporting import *
|
||||||
|
from anki.importing import Anki2Importer
|
||||||
from anki.stdmodels import *
|
from anki.stdmodels import *
|
||||||
from shared import getEmptyDeck
|
from shared import getEmptyDeck
|
||||||
|
|
||||||
|
@ -54,6 +55,36 @@ def test_export_ankipkg():
|
||||||
os.unlink(newname)
|
os.unlink(newname)
|
||||||
e.exportInto(newname)
|
e.exportInto(newname)
|
||||||
|
|
||||||
|
@nose.with_setup(setup1)
|
||||||
|
def test_export_anki_due():
|
||||||
|
deck = getEmptyDeck()
|
||||||
|
f = deck.newNote()
|
||||||
|
f['Front'] = u"foo"
|
||||||
|
deck.addNote(f)
|
||||||
|
deck.crt -= 86400*10
|
||||||
|
deck.sched.reset()
|
||||||
|
c = deck.sched.getCard()
|
||||||
|
deck.sched.answerCard(c, 2)
|
||||||
|
deck.sched.answerCard(c, 2)
|
||||||
|
# should have ivl of 1, due on day 11
|
||||||
|
assert c.ivl == 1
|
||||||
|
assert c.due == 11
|
||||||
|
assert deck.sched.today == 10
|
||||||
|
assert c.due - deck.sched.today == 1
|
||||||
|
# export
|
||||||
|
e = AnkiExporter(deck)
|
||||||
|
e.includeSched = True
|
||||||
|
newname = unicode(tempfile.mkstemp(prefix="ankitest", suffix=".anki2")[1])
|
||||||
|
os.unlink(newname)
|
||||||
|
e.exportInto(newname)
|
||||||
|
# importing into a new deck, the due date should be equivalent
|
||||||
|
deck2 = getEmptyDeck()
|
||||||
|
imp = Anki2Importer(deck2, newname)
|
||||||
|
imp.run()
|
||||||
|
c = deck2.getCard(c.id)
|
||||||
|
deck2.sched.reset()
|
||||||
|
assert c.due - deck2.sched.today == 1
|
||||||
|
|
||||||
# @nose.with_setup(setup1)
|
# @nose.with_setup(setup1)
|
||||||
# def test_export_textcard():
|
# def test_export_textcard():
|
||||||
# e = TextCardExporter(deck)
|
# e = TextCardExporter(deck)
|
||||||
|
|
Loading…
Reference in a new issue