Commit graph

106 commits

Author SHA1 Message Date
Damien Elmes
c14f5a1142 Merge pull request #397 from agentydragon/remove-coding
Remove unneeded utf-8 encoding declaration
2019-12-28 07:11:21 +10:00
Damien Elmes
d9444190c0 Merge pull request #396 from agentydragon/remove-reimport2
Remove unnecessary anki.* qualification of already imported Note, Card
2019-12-28 07:11:14 +10:00
Damien Elmes
6c720f241f Merge pull request #395 from agentydragon/remove-reimport
Remove unneeded re-import of anki.db
2019-12-28 07:11:03 +10:00
Michal Pokorný (Rai)
0e37dd0c2b Remove unnecessary anki.* qualification of already imported Note, Card 2019-12-27 19:22:44 +01:00
Michal Pokorný (Rai)
8655a65567 Remove unneeded utf-8 encoding declaration
UTF-8 is the default as of Python 3.
See: https://docs.python.org/3/reference/lexical_analysis.html#encoding-declarations
2019-12-27 18:06:06 +01:00
Michal Pokorný (Rai)
194bfecc0f Remove unneeded re-import of anki.db 2019-12-27 17:22:53 +01:00
Michal Pokorný (Rai)
3c8cc9ca82 Add return value comment for fixIntegrity method of Collection 2019-12-27 17:20:22 +01:00
Damien Elmes
7a4ec4d6fd hold off on general release of v2 scheduler for now
The switch to the new timezone code may shift some users back or forth
a day, so it'd be better to have this in place prior to making the
new scheduler the default.
2019-12-27 21:53:20 +10:00
Damien Elmes
ff86452641 send tz offset at start of sync; allow passing in offset at collection creation 2019-12-27 21:53:20 +10:00
Damien Elmes
7fceffa890 rework the new scheduler's rollover/day counting code
The previous implementation interpreted the creation date as a local
time, and applied the rollover to that. If the initial creation date
was around midnight local time, even a one hour change due to daylight
savings could result in Anki skipping or doubling up on a day. To
address this, the rollover is now applied to the current time instead
of the creation date.

The new code needs the current time passed into it. This makes it
easier to unit test, and for AnkiWeb to be able to use the user's local
timezone.

The new timezone code is currently disabled, as this code needs to be
ported to all clients before it can be activated.
2019-12-27 21:53:20 +10:00
Damien Elmes
8ef1fa7ed1 bridge->backend 2019-12-25 08:59:33 +10:00
Damien Elmes
e05b77b083 use protobuf for python/rust bridge
If we go ahead with betterproto on the Python side, it will mean
bumping the minimum Python dependency to 3.7.
2019-12-24 19:57:54 +10:00
Damien Elmes
9e245ae621 apply black to all files 2019-12-23 10:34:10 +10:00
Damien Elmes
c4b4f55a7a Merge pull request #382 from agentydragon/whitespace
Whitespace reformat to force 80-character line limit
2019-12-23 09:35:56 +10:00
Michal Pokorný (Rai)
1c2e6666c4 Whitespace reformat to force 80-character line limit 2019-12-23 00:30:59 +01:00
Michal Pokorný (Rai)
c1e8e00bb4 Move QA data tuple into separate type alias 2019-12-23 00:27:14 +01:00
Damien Elmes
ed02a3fc7e Model->NoteType 2019-12-22 08:58:56 +10:00
Michal Pokorný (Rai)
c22e22e8ae Add types for models, templates and field dicts 2019-12-21 12:02:16 +01:00
Damien Elmes
8095ad8e4b use isort to tidy up imports 2019-12-20 19:19:29 +10:00
Damien Elmes
dc0fdaeea5 add a bunch of annotations for mypy 2019-12-20 15:07:40 +10:00
Damien Elmes
85e1a1c772 importing 2019-12-20 11:41:24 +10:00
Damien Elmes
0c5d1db81d collection 2019-12-20 11:07:08 +10:00
Damien Elmes
9983774a12 add pytype inferred types to anki/
I've corrected some obvious issues, and we can fix others over time.
Mypy tests are currently broken, as adding the type hints has increased
mypy's testing surface.
2019-12-20 11:07:08 +10:00
Damien Elmes
6b78cf8d68 don't set local offset in server mode 2019-12-17 17:10:56 +10:00
Damien Elmes
0e1118aab4 avoid recalculating reqs in actions like adding cards 2019-12-16 20:27:58 +10:00
Damien Elmes
7fe4a7c4ef work around some typing inference issues 2019-12-16 17:52:51 +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
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
0a13c340d3 default to v2 scheduler on new installs, remove warning 2019-12-06 18:37:39 +10: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
lovac42
390dece050 clears undo before changing schedulers 2019-08-30 20:55:38 -04:00
Damien Elmes
c2ea31422e fix flag changes in browser not syncing 2019-07-09 15:16:02 +10:00
Damien Elmes
a0fe168137 wrap due numbers instead of capping them, and add warning
Wrapping (mostly) preserves the original card order, and starting
at 1M makes it easier for users to find the cards with the high
due numbers even after they have wrapped.

related discussion:
https://anki.tenderapp.com/discussions/ankidesktop/33664-due-value-of-new-card-being-1000000
2019-04-29 18:17:33 +10:00
Damien Elmes
98ce38dcdd ensure the list of note types is not empty
fixes an issue opening the add screen if a user manages to delete
all their note types with an add-on or a sync
2019-04-21 18:02:12 +10:00
Damien Elmes
75a95ee1fb tidy up unused imports 2019-03-04 17:25:19 +10:00
Damien Elmes
5ca567362c style and arg order fix 2019-02-18 12:44:04 +10:00
Arthur-Milchior
2608513381 Show deck of the addCard window 2019-02-16 12:25:22 +01:00
Arthur-Milchior
7e72361b22 Correct deck when previewing an existing card 2019-02-16 11:28:50 +01:00
Damien Elmes
a7eb6bb357 update copyright and clarify licenses 2019-02-05 14:01:33 +10:00
Damien Elmes
8261873364 make sure bulk flag changes sync
https://anki.tenderapp.com/discussions/ankidesktop/31774-flag-syncing-bug
2019-02-05 13:01:07 +10:00
Damien Elmes
852b9b60d7 support {{CardFlag}}
https://anki.tenderapp.com/discussions/ankidesktop/32158-flags
2019-02-05 13:00:47 +10:00
Damien Elmes
7dada26674 fix decimal intervals in revlog as well 2019-02-05 12:30:22 +10:00
Damien Elmes
b50edbd3ae fix due column as well in db check 2019-02-04 14:33:53 +10:00
Damien Elmes
bc8bd7b092 add decimal ivl fix to fixIntegrity() 2019-01-29 08:17:24 +10:00
Damien Elmes
df72b02dda when rebuilding field cache make sure we don't discard filenames
stripHTMLMedia() already used in notes.py
2018-09-20 15:28:28 +10:00
Damien Elmes
46d27136ce catch suspended new cards w/ wrong due number
https://anki.tenderapp.com/discussions/ankidesktop/29267-01
2018-08-30 12:43:53 +10:00
Mai Lavelle
8832bfb7ee avoid reordering entire deck when importing notes
No need to reorder existing cards, which may have been manually
ordered by the user, when importing notes if we can give cards
a proper due number from the start. Retrieving any sibling's
due number for this is easy as all relevant cards will have
already been queried for when generating the new cards.
2018-07-06 00:49:47 -04:00
Damien Elmes
7c79f24916 add option to show day learn cards before reviews 2018-01-20 16:07:57 +10:00
Damien Elmes
3c728e60f5 support sched versions in collection 2018-01-14 16:58:04 +10:00
Damien Elmes
174e1a46b3 fix error when importing 2017-12-12 11:55:27 +10:00