Commit Graph

56 Commits

Author SHA1 Message Date
Damien Elmes
aa89d06304 Revert "don't rely on cwd in media.py"
This reverts commit 975ca90225.

reverting for now as it breaks showing of images during review
2017-04-11 12:50:33 +10:00
Joel Kitching
975ca90225 don't rely on cwd in media.py
media.py sets CWD to the media directory of the collection
(collection.media), and relies on that directory being
maintained as CWD throughout execution.  The original CWD
is restored in the close() function.

Remove reliance on CWD being set and maintained throughout
execution of media.py.  Improves portability and usability
in different codebases.
2017-03-07 15:55:40 +08:00
Damien Elmes
c17e68d5f3 Merge pull request #176 from luoliyan/escape-sql-queries
Allow user to escape special characters in tags
2017-03-01 22:49:47 +10:00
luoliyan
62a76b3ad9 Test special characters in tag search 2017-02-28 08:11:32 +09:30
Damien Elmes
ef5ed0ebf3 fix unit test on python 3.6 2017-02-27 14:29:23 +10:00
Damien Elmes
227ca090db use a constant for the starting factor 2017-02-08 17:28:12 +10:00
Damien Elmes
18ccf26a2e fix intermittent failing test 2017-02-08 16:54:59 +10:00
Damien Elmes
dc022142cf fix test_find.py tests 2017-02-08 16:49:59 +10:00
Damien Elmes
e3efe8e10e fix intermittently failing tags test 2016-09-05 18:25:44 +10:00
Damien Elmes
85665bc18d fix latex check 2016-07-04 17:07:48 +10:00
Damien Elmes
0c20da1069 fix conditional templates 2016-06-30 22:23:31 +10:00
Damien Elmes
15b349e3a8 start port to python 3
unit tests pass and main screens of GUI load
2016-05-12 14:45:35 +10:00
Damien Elmes
1dce3eaaff drop anki1 upgrade code 2016-05-12 14:20:59 +10:00
Arne Ludwig
d8d9bf4dcd Extended LaTeX tests on bad commands 2015-07-30 12:43:41 +02:00
Damien Elmes
b0f7ddfefb don't bump mod time when moving cards into/out of a filtered deck
fixes the following:
- create a filtered deck and sync it
- review cards in the filtered deck and delete it
- sync again

The filtered deck deletion was bumping the mod time on cards at the
start of the sync, preventing the reviews from being synced from the
other side, leading to lost reviews and sanity check errors.
2015-03-19 15:35:04 +11:00
Damien Elmes
354fbd33f6 fix media test 2014-07-28 14:26:40 +09:00
Soren I. Bjornstad
c3434ff751 update note type on apkg import when only templates have changed
Previously, it only updated if card/note count was different, even if
the templates / styling information had been updated.
2014-06-28 13:51:30 -05:00
dae
d358686c07 remove remote sync tests, as they can't be run by regular users 2014-06-03 18:22:29 +09:00
dae
54a85f6be7 disable broken unit test 2014-06-03 18:17:02 +09:00
dae
8491c907ba fix cloze order
must be next to Text now; will document
2014-06-03 18:05:09 +09:00
dae
09253b661c getEmptyDeck() -> getEmptyCol() 2014-06-03 17:38:47 +09:00
dae
e5ed110d65 fix latex test 2014-06-03 17:25:43 +09:00
ispedals
bd289fc37e Close file descriptors before unlinking
Unlinking a file before closing may not be supported on non-POSIX systems
such as Windows. This allows more tests to run to completion.
2014-04-21 17:08:21 -04:00
Julien Baley
a88a8429e2 Makes the test agree with the current behaviour of chained mod (cloze not always first) 2014-04-15 17:39:09 +01:00
Damien Elmes
8b1cca0412 remove debug statements from test 2014-02-19 18:01:29 +09:00
Damien Elmes
6da0e688b3 Merge pull request #64 from julienbaley/chained_mods
Chained mods
2014-02-19 17:59:57 +09:00
Julien Baley
37753b1ffd Adding tests for chained modifiers 2014-02-18 17:26:41 +00:00
Damien Elmes
a0f16d8ecb Merge pull request #59 from chreekat/faster-tests
Speed up tests
2014-02-17 11:22:14 +09:00
Bryan Richter
04d3901491 Test against the value itself 2014-02-12 23:46:38 -08:00
Bryan Richter
827bb84418 Re-use an empty deck to save on creation time. 2014-02-12 23:33:44 -08:00
Bryan Richter
349c95d17a Fix supermemo import test
Broken by 656698d, "Add A Factor to E Factor conversion..."
2014-02-12 23:23:15 -08:00
Damien Elmes
19b1446758 automatically remove from filtered deck before reschedule
commit 79ed57a445 prevented reschedule
on cards in a filtered deck, but it is more user friendly to
automatically move back to the home deck instead. we also don't need
to removeLrn() for review cards, because we're updating type+queue+odue
ourselves
2013-11-26 03:23:03 +09:00
Damien Elmes
99d82c1f2d fix hasIllegal check, and associated unit test 2013-11-26 03:19:11 +09:00
Damien Elmes
f1837e7e0a when ensuring model unique, check id not obj
this should fix an issue where we were attaching a suffix to non-duplicate
names on sync
2013-10-05 23:53:09 +09:00
Damien Elmes
f29a04ae29 bump sync ver to 7 and change meta return value
- /sync/meta now returns a dictionary
- it includes the following extra fields
- msg: if non-empty, show this message at the end of the sync
- cont: if false, show above message and abort sync
- uname: the user's email address, so it can be stored by the local client to
  show users who have forgotten which email address they used. in the future
  this will be saved only when logging in, so do a conditional access on it
2013-10-04 06:09:28 +09:00
Damien Elmes
ec3850aab2 note rollover problem in unit tests 2013-10-02 04:04:06 +09:00
Damien Elmes
0d1d8c5bf9 define standard encoding for unicode (#893)
- always store media references in fields in NFC form
- always encode filenames on disk in NFC form on machines other than macs
- use relevant encoding when placing files in the media folder during syncs
  and apkg imports as well
- rename 'unused media' back to 'check media'
- check media can now automatically change media references and filename
  encodings to the correct format
2013-09-20 19:28:44 +09:00
Damien Elmes
afde11671e rework sibling handling and change bury semantics
First, burying changes:

- unburying now happens on day rollover, or when manually unburying from
  overview screen

- burying is not performed when returning to deck list, or when closing
  collection, so burying now must mark cards as modified to ensure sync
  consistent

- because they're no longer temporary to a session, make sure we exclude them
  in filtered decks in -is:suspended

Sibling spacing changes:

- core behaviour now based on automatically burying related cards when we
  answer a card

- applies to reviews, optionally to new cards, and never to cards in the
  learning queue (partly because we can't suspend/bury cards in that queue at
  the moment)

- this means spacing works consistently in filtered decks now, works on
  reviews even when user is late to review, and provides better separation of
  new cards

- if burying new cards disabled, we just discard them from the current queue.
  an option to set due=ord*space+due would be nicer, but would require
  changing a lot of code and is more appropriate for a future major version
  change. discarding from queue suffers from the same issue as the new card
  cycling in that queue rebuilds may cause cards to be shown close together,
  so the default burying behaviour is preferable

- refer to them as 'related cards' rather than 'siblings'

These changes don't require any changes to the database format, so they
should hopefully coexist with older clients without issue.
2013-08-10 15:56:26 +09:00
Damien Elmes
914f56dbc0 allow updates to existing notes in .apkg import 2013-08-08 13:01:47 +09:00
Damien Elmes
a538e29480 refactor illegal char handling and file adding for media
- add writeData() so we can add files to media folder without having to
  save them in an intermediate folder first
- we were stripping or checking for illegal filename characters in
  multiple places; factor those checks out into separate routines
- add * to invalid char list, and disallow both forward and backslash
- remove size checks in syncAdd(); is handled server-side
2013-07-11 15:33:24 +09:00
Damien Elmes
744d9abfdb fix modification check in note merge 2013-05-28 14:41:12 +09:00
Damien Elmes
7b217c63fe fix unit test 2013-05-27 14:30:23 +09:00
Damien Elmes
918694a096 more media regexp fixes
- split quoted and unquoted image case into separate regexps, since we can't
  include a group reference inside a character set
- disallow spaces in the non-quoted case
- this should fix matching on images with other attributes again
2013-05-22 09:45:58 +09:00
Damien Elmes
3dd72ad4d6 log updates & duplicates (#859) 2013-05-16 17:24:12 +09:00
Damien Elmes
d2535fd6cb run basic integrity check prior to full up 2013-05-13 19:36:09 +09:00
Damien Elmes
735a706bc1 fix import test file 2013-04-11 18:51:38 +09:00
Damien Elmes
9f5d23319d check for dvipng in test 2013-03-16 06:40:03 +09:00
Damien Elmes
71bc925e8b show (end) when exiting with resched=off 2013-02-01 00:25:01 +09:00
Damien Elmes
17b68d5dc0 fix import of suspended anki1 cards (#565) 2013-01-23 15:28:11 +09:00
Damien Elmes
634b28388c remove obsolete test
the server bumps the modtime prior to download these days because it has to
update the usn
2013-01-18 08:43:40 +09:00