Commit graph

830 commits

Author SHA1 Message Date
Damien Elmes
f70e439d95 Revert "DeckManager: _checkDeckTree ignore case"
This reverts commit a6dab26d45.

This commit broke collections that had children under each of the
the duplicate names - it renames one of the decks, but the children
of the renamed deck are left without a parent, causing an error like

line 235, in deckDueList  nlim = min(nlim, lims[p][0])\n\nKeyError('..)

Rather than a more complicated approach, I think it's safer just to
leave the case or normalization-differing decks around for now, and
we can normalize things properly in a future schema upgrade.
2019-12-20 08:18:01 +10:00
Damien Elmes
6b78cf8d68 don't set local offset in server mode 2019-12-17 17:10:56 +10:00
Damien Elmes
bcb469f3e4 Merge pull request #361 from Arthur-Milchior/testReqs
test req
2019-12-16 20:44:23 +10:00
Damien Elmes
0e1118aab4 avoid recalculating reqs in actions like adding cards 2019-12-16 20:27:58 +10:00
Damien Elmes
99181ce986 fixes cycles in template imports 2019-12-16 18:16:26 +10:00
Damien Elmes
78fd924525 don't try to decode str 2019-12-16 18:08:17 +10:00
Damien Elmes
a4914b75ac clarify hasIllegal() arg 2019-12-16 17:54:57 +10:00
Damien Elmes
53ffd13c98 mpv was passing separators incorrectly and unnecessarily 2019-12-16 17:54:40 +10:00
Damien Elmes
6a72b9eedc fix type inference in scheduler 2019-12-16 17:54:17 +10:00
Damien Elmes
2e4a46e87b fix mplayer typecheck 2019-12-16 17:54:04 +10:00
Damien Elmes
b23c7b07f4 handle invalid field mod regex 2019-12-16 17:53:43 +10:00
Damien Elmes
3304e74f10 Sniffer technically expects a string, not a list 2019-12-16 17:53:20 +10:00
Damien Elmes
7fe4a7c4ef work around some typing inference issues 2019-12-16 17:52:51 +10:00
Damien Elmes
513aef78cf platform-specific imports 2019-12-16 17:51:33 +10:00
Damien Elmes
2610099885 ignore missing props in the supermemo importer 2019-12-16 17:50:43 +10:00
Damien Elmes
14b7828135 set instance vars in __init__() 2019-12-16 17:49:32 +10:00
Damien Elmes
e15bed745f be explicit in our not-None assumptions to appease type checker 2019-12-16 17:47:07 +10:00
Damien Elmes
41940c8575 pytype is confused by import from parent module
this change prevents the cache from constantly being rebuilt
2019-12-16 17:41:47 +10:00
Arthur Milchior
5afc93d8c8 update requireds saves reqs as lists instead of tuples.
The goal of this change is to be consistent with JSON. Indeed, the
dictionnary is saved as JSON, which has list and does not has
tuple. The request was made in https://github.com/dae/anki/pull/361#issuecomment-565915191
2019-12-15 22:55:29 -08:00
Damien Elmes
6e19639a8c don't try to remove tmp folder if it's already been removed 2019-12-16 10:07:20 +10:00
Damien Elmes
df69b03995 fix travis build 2019-12-16 08:22:47 +10:00
Damien Elmes
fb6b53e234 add basic type checking for anki/ 2019-12-16 08:17:28 +10:00
Damien Elmes
33685461d0 bump version 2019-12-15 15:32:24 +10:00
Damien Elmes
ba2d5df16c save local timezone to conf
saves the user needing to visit AnkiWeb when their timezone has changed
2019-12-12 11:30:01 +11:00
Damien Elmes
d99cca56cf sort due in filtered decks by ordinal, like normal review
https://anki.tenderapp.com/discussions/ankidesktop/37419-card-order-of-siblings-not-preserved-in-filtered-deck#comment_47910714
2019-12-11 08:12:50 +10:00
Damien Elmes
79ab33ee49 add a token 1 day bonus so easy on a relearn card differs from good
https://anki.tenderapp.com/discussions/beta-testing/1589-anki-2116-beta#comment_47905454
2019-12-09 12:12:29 +10:00
Damien Elmes
39f6c9fa2b allow importing scheduling-inclusive v1 imports into v2 2019-12-06 19:03:57 +10:00
Damien Elmes
f8d17a90af enable scheduling-inclusive exports from 2.1 2019-12-06 18:51:42 +10:00
Damien Elmes
0a13c340d3 default to v2 scheduler on new installs, remove warning 2019-12-06 18:37:39 +10:00
Arthur Milchior
eba789db53 list of decks contains default iff deck chooser contains default
This way, the list is consistent with what users see otherwhere
2019-12-05 08:20:11 +01:00
Arthur Milchior
d6b0f225a0 newField checks its input is a str
Indeed, it takes as input a name (str). For some reason in some test
it was given a model. This actually led to some strange failed test.
2019-11-25 00:15:20 +01:00
Damien Elmes
83351ea515 minor grammar tweak 2019-11-14 09:27:25 +10:00
Damien Elmes
0ba06e2d6c Merge pull request #352 from Arthur-Milchior/correctCaseInRename
Ensure that even childless deck's name is considered independtly of the case
2019-11-14 09:25:34 +10:00
Arthur Milchior
27834ab932 Correcting flag search
Currently, "flag:01" or "flag:12" does not throw exception, while it
should. Now it'll be the case
2019-11-13 17:41:48 +01:00
Arthur Milchior
a6dab26d45 DeckManager: _checkDeckTree ignore case 2019-11-13 17:08:40 +01:00
Arthur Milchior
c81958531f Rename reject even when another deck has same name different cases 2019-11-13 17:08:40 +01:00
Arthur Milchior
6448d3de5f DeckManager.id return existing deck ignoring case 2019-11-13 16:34:14 +01:00
Arthur Milchior
aa5bb21785 DeckManager.byName check equality ignoring case name 2019-11-13 16:33:56 +01:00
Arthur Milchior
de0e08eaed Decks: methods to normalize name and check equality of name 2019-11-13 16:33:39 +01:00
Damien Elmes
a139f5eb03 Merge pull request #346 from Arthur-Milchior/dontTranslateShortcut
Tells QT not to translate shortcuts.
2019-11-03 08:50:04 +10:00
Damien Elmes
76ac566b0a force a full sync when fields or templates changed without schema mod
This is not an ideal solution and will not catch repositioned fields
or templates, but is at least an improvement over the previous behaviour.

https://github.com/dae/anki/pull/349#issuecomment-547236285
2019-10-30 10:17:09 +10:00
Damien Elmes
fc085750f5 use --exact with dvisvgm
https://anki.tenderapp.com/discussions/ankidesktop/36561-latex-svgs-getting-cut-off
2019-10-28 08:43:49 +10:00
Damien Elmes
41c0a3f9a8 Revert "Merge pull request #345 from Arthur-Milchior/noFullSyncWhenEditingNewModel"
This reverts commit ac445b3def, reversing
changes made to b4d041a2ee.

This approach is flawed. Any minor change to the note type will set usn
to -1, causing the schema not to be modified when it should be.
2019-10-27 21:37:21 +10:00
Arthur Milchior
3e0f5696db Use _modSchemaIfRequired in all cases.
Same logic than in last commit. Actually, there is no change of model
which need a full sync until the model is uploaded. After all, even if
a change in model imply that some card will change, those cards and
notes have not been uploaded either
2019-10-24 04:45:12 +02:00
Arthur Milchior
66d019422c New model can be edited without full sync
This commit solves a problem that I had many time in the past. When I
create a new model, I usually want to edit it. Clone of existing
models present no interest by themselves. And as soon as I edit it, I
need to do a full sync.

As far as I understand ankiweb (which is sadly closed source), the
full sync is required because ankiweb needs to know that the model
associated to note type on the server did change. But since the model
is new, it has no note type associated to on the server, so there is
no need to do a full sync immediatly. Since the model is new, it also
means there is no risk of the inconsistency with a change made in
another computer/smartphone.

Thus, when a field/template is added, I check that the model is not
new by checking both whether it's id is not null, and also that it's
usn is not -1. (I set usn early in the model's life)

If it does not make into anki, then it'll be an add-on. But it's worth
a try first.
2019-10-24 04:44:52 +02:00
Arthur Milchior
f9ddb4abd9 Adding explanation to translators
Some strings are missing in French at least. And some are quite
complex to understand. Especially without context, without knowledge
of Python. I tried to copy the only indication I found and add more
indication, hoping I did it correctly.
2019-10-24 02:36:32 +02:00
Arthur Milchior
75c118b2a2 Factorize standard models to use other models
As discussed in
https://github.com/dae/anki/pull/340#issuecomment-544749153
2019-10-22 02:43:20 +02:00
Arthur Milchior
bf1048d904 Making newBasicModel private
Following @timrae's advice on the pull request #340.
2019-10-21 07:02:08 +02:00
Arthur Milchior
4df6af3174 Creating now basic type without doing full sync
There is currently what I believe to be a small bug in anki. You can
clone a note type without doing a full sync, but you can't create
forwardReverse and forwardOptionalReverse note type without doing a
full sync. On the other hand you can clone, and even create any other
basic type without doing a full sync.

This commit simply wants to correct this.

The main trouble is that the method to create a copy of forwardReverse
and forwardOptionalReverse use a copy of the basic model, and add this
copy in the model manager BEFORE adding yet another template. This
commit corrects it by ensuring that the model is added only after all
templates are added, so that anki does not detect any change of a
template in the schema.

In order to do this, I created a method newBasicModel which creates
the basic model without adding it.

By the way, addBasicTypingModel could also use newBasicModel, and then
only change afmt. I didn't do it here because I believe that you want
the change to be minimal, and this correction would not add any
feature, only factorize the code.
2019-10-21 02:30:06 +02:00
Arthur Milchior
d33503177d New cards of existing note take due value of NEW siblings
Here is a bug, how to reproduce it, and why this is a fix.

This is a way to create a new note with a due card extremly high
without any add-on, just with basic anki.

Bug
===
Create a note type with three fields One, Two, and Three and three card
type One, Two and Three such that each card is generated when the
field of the same name is filled.

Create a note with fields One and Two filled only. Review card One and
click on good. Card one should goes in learning mode. Fill the field
Three. In the browser, you'll see that card Two and Three are new, but
card Two and Three's due value are distinct. More precisely, the due
value of card Three is equal to the due value of card One; except that
in card One it's interpreted as a timestamp, while in card Three it's
interpreted as a position in the list of new card.

You'll remark by the way that the due of card Three is extremly high,
potentially more than 1000000; which may explain why so many
collection has this bug.

Fix
===
Only consider due value of new cards.
2019-10-19 06:28:10 +02:00