Commit graph

2228 commits

Author SHA1 Message Date
user1823
ba0d590c16
Clear desired retention and decay when changing decks (#4095)
These values are preset-specific and entries from previous deck may cause issues.
2025-06-19 13:23:49 +07:00
Damien Elmes
4040a3c1f9 Fix stale 'now' in timing info
Closes #4089
2025-06-18 12:18:38 +07:00
Jarrett Ye
615bbf95a1
update to fsrs-rs 4.0.0 (#4080)
* update to fsrs-rs 4.0.0

* fix ci

* update test
2025-06-14 12:48:33 +07:00
Luc Mcgrady
11cc9287ff
Fix/Missing cardID special field (#4078) 2025-06-13 10:47:16 +07:00
Jarrett Ye
ce6497cd2b
Fix/remove the lower limit of interval when set due date (#4063)
* Fix/remove the lower limit of interval when set due date

* don't affect SM-2

* Apply patch from user1823

* Fix build

* More suggestions from user1823
2025-06-08 15:36:32 +07:00
sorata
e5d34fbb18
Update default styles (#4060)
* add margin for hr

* add line height to default styles

* update my email

* change margin to 1em
2025-06-08 11:24:46 +07:00
Damien Elmes
2427743751 Formatting fix
I have checks running on push, but must have confused the build system
by modifying the file at the wrong time.
2025-06-06 13:19:47 +07:00
Damien Elmes
933d63545a Stop collapsing reschedule entries
Closes #3316
2025-06-06 13:13:48 +07:00
Luc Mcgrady
55ecbc1125
Feat/Health check (#4047)
* Message on low log loss

* make console.log permanent

* Added: Health check option

* disable button

* change health check conditions

* i18n

* ./check

* Apply suggestions from code review

Co-authored-by: user1823 <92206575+user1823@users.noreply.github.com>

* delete shadowed fsrs

* Update ts/routes/deck-options/FsrsOptions.svelte

Co-authored-by: llama <gh@siid.sh>

* Update ftl/core/deck-config.ftl

Co-authored-by: user1823 <92206575+user1823@users.noreply.github.com>

* anon's suggestions

* snake_case

* capital slow

* make global

* on by default

* Adjusted loss values

* Show message on pass

* ./check

* ComputeParamsRequest

* update coefficients

* update thresholds

* fix thresholds

* Apply suggestions from code review

---------

Co-authored-by: user1823 <92206575+user1823@users.noreply.github.com>
Co-authored-by: llama <gh@siid.sh>
Co-authored-by: Damien Elmes <dae@users.noreply.github.com>
2025-06-06 12:43:33 +07:00
Jarrett Ye
8add993fca
improve the accuracy of the expected workload calculation (#4056)
* improve the accuracy of the expected workload calculation

* ./ninja fix:minilints

* implement smoothing & a separate struct for return value

* set TERMINATION_PROB to 0.001
2025-06-04 18:20:12 +07:00
llama
174b199164
Add IO mask colour fill tool (#4048)
* add fill tool

* add fill tool logic

* open colour picker on fill tool activation

* refactor/add fill attr to io clozes

* fill masks in editor

* fill text and inactive masks in reviewer

* fix lint

* remove debug option
2025-06-04 11:45:34 +07:00
Luc Mcgrady
bbac90d97d
Fix/Invalid parameter counts saveable (#4052)
* Add frontend check for parameters

* Fix backend

* ./check

* Fix: Wrong type
2025-06-03 16:27:04 +07:00
Jarrett Ye
2de0c79ba5
Feat/evaluate FSRS with time series split (#3962) 2025-06-03 15:26:33 +07:00
Luc Mcgrady
a99beb71fe
Feat/Card ID special field (#4046)
* Feat/Card ID special field

* remove clone
2025-06-02 16:35:13 +07:00
Luc Mcgrady
f29bcb743b
Feat/Desired retention warning improvements (#3995)
* Feat/90% desired retention warning

* Update ftl/core/deck-config.ftl

* show on newly enabled

* Show warning on focus

* Never hide warning

* Display relative change

* Add: Separate warning for too long and short

* Revert unchanged text changes

* interval -> workload

* Remove dead code

* fsrs-rs/@L-M-Sherlock's workload calculation

* Added: delay

* CONSTANT_CASE

* Fix: optimized state

* Removed "Processing"

* Remove dead code

* 1 digit precision

* bump fsrs-rs

* typo

* Apply suggestions from code review

Co-authored-by: Damien Elmes <dae@users.noreply.github.com>

* Improve rounding

* improve comment

* rounding <1%

* decrease rounding precision

* bump ts-fsrs

* use actual cost values

* ./check

* typo

* include relearning

* change factor wording

* simplify sql

* ./check

* Apply suggestions from code review

Co-authored-by: user1823 <92206575+user1823@users.noreply.github.com>

* Fix: missing search_cids

* @dae's style patch

* Fix: Doesn't update on arrow keys change

* force two lines

* center two lines

---------

Co-authored-by: user1823 <92206575+user1823@users.noreply.github.com>
2025-05-27 13:07:21 +10:00
Jarrett Ye
1e6d12b830
Set Due Date: Set interval to actual elapsed days when FSRS is enabled (#4035) 2025-05-26 23:33:39 +10:00
Jarrett Ye
dfee38898d
calculate accurate retrievability in card info (#4034) 2025-05-26 23:25:27 +10:00
llama
d667abffd1
Fix searching for non-blank adjacent wildcard fields (#4009)
* modify collect_ranges to take param on whether to join ranges

* update tests

* update existing call

* fix searching for non-empty wildcard fields
2025-05-19 13:15:23 +10:00
Damien Elmes
48a0640a07 Revert "feat(scheduler): add from_queue flag to CardAnswer (#3976)"
This reverts commit 1f95d030bb.

Buggy: https://github.com/ankitects/anki/pull/3983
2025-05-19 10:26:10 +10:00
user1823
8f2c708751
Include reset entries in dataset exported for research (#3998)
https://github.com/open-spaced-repetition/fsrs4anki-helper/pull/566#issuecomment-2875432135
2025-05-15 16:31:18 +10:00
GithubAnon0000
f727934a42
CHANGE collection size too large error to add MB values and info about compressed vs. uncompressed. (#3981)
* CHANGE collection size too large error to add MB values and info about compressed vs. uncompressed

* Round f64 to 2 decimals

* Remove line breaks from ftl/core

* Remove string 'uncompressed' from code

* Add string 'uncompressed' to ftl/core

* Remove if statement change introduced to test changes locally

* Run ./check
2025-05-15 15:08:41 +10:00
llama
573f59fab1
Allow rotating IO masks (#3987)
* Revert "Disable rotation globally"

This reverts commit 22736238c1.

* alt. impl for hiding rotation marker when selecting/ungrouping

* (de)serialise angles

* rotate masks in reviewer

* update bounds checking

* floats.ts -> lib.ts

* add convenience fns

* store mask angles (deg) in steps of 10000

* update CONTRIBUTORS
2025-05-10 16:21:33 +10:00
Luc Mcgrady
e06852a0ed
Fix/SQL retrievability underflow (#3980)
* Fix/Saturating sub called before u32 conversion

* more
2025-05-05 18:49:12 +10:00
Matt Brubeck
bcb28f0a85
Use first >= 1d interval for starting memory state (#3959)
When a filtered revlog history begins with one or more < 1d intervals
(for example, because it starts in the middle of a sequence of
relearning steps), use the first >= 1d interval to calculate the initial
memory state.

Bug report thread:

https://forums.ankiweb.net/t/fsrs-stability-when-first-non-ignored-revlog-has-a-relearning-interval/59894
2025-05-05 15:49:06 +10:00
Yaoliang Chen
1f95d030bb
feat(scheduler): add from_queue flag to CardAnswer (#3976)
Co-authored-by: Yaoliang <yaoliang.ch@gmail.com>
2025-05-03 12:21:48 +03:00
Jarrett Ye
bd67e9fe1b
Fix/stability doesn't increase after pressing good (#3975) 2025-05-03 12:04:35 +03:00
Jonathan Schoreels
963fcf7c60
Check if self.card.reps>0 before substracing 1 (#3966)
* Check if self.card.reps>0 before substracing 1

* Fix formatting

* Use a more rust-y way to avoid the Panic for underflow, especially wé're talking seed value

Co-Authored-By: jake <jake@sharnoth.com>

---------

Co-authored-by: jake <jake@sharnoth.com>
2025-04-30 21:53:36 +10:00
Matt Brubeck
ef37952ba0
Remove dead code in reviews_for_fsrs (#3958)
* Clarify logic in reviews_for_fsrs

Prior to this change, the second check of `first_of_last_learn_entries`
was dead code because the first check would always break out of the loop
before it could succeed.  Re-order the code for clarity and add a
comment to explain the logic.

* Update CONTRIBUTORS
2025-04-30 21:28:30 +10:00
Jarrett Ye
07033435a6
Fix/remove incorrect invalid input check (#3963) 2025-04-29 02:10:19 +03:00
Luc Mcgrady
ad073ab10c
Feat/CMRR uses simulate config (#3947)
* Added: simulate_request_to_config

* Use SimulateConfig for CMRR

* ./check

* Fix: ComputingRetention

* Use actual cards for optimal_retention
2025-04-27 21:02:37 +10:00
Damien Elmes
1e2f11a271 Latest FSRS 2025-04-27 19:48:43 +10:00
Jarrett Ye
90f2e06b17
Fix/missing-simulator-decay-for-FSRS-5 (#3956) 2025-04-27 17:20:13 +10:00
Jarrett Ye
6d0e52e8a0
Fix/incorrect fallback of decay (#3954) 2025-04-27 17:19:59 +10:00
Luc Mcgrady
2406830ff9
Fix/no memory state revlogs in reverse order on card stats screen. (#3951) 2025-04-26 12:09:40 +10:00
user1823
9872645d5a
Update sorting by R for FSRS 6 (#3949)
* Update sorting by R for FSRS 6

* Update sqlite.rs
2025-04-26 12:05:38 +10:00
Jarrett Ye
a5778f3377
Fix/FSRS-6 doesn't give <1d intervals & use log loss instead of RMSE(bins) (#3948)
* Fix/FSRS-6 doesn't give <1d intervals

https://forums.ankiweb.net/t/anki-25-05-beta-1/59710/8?u=l.m.sherlock

* use log loss instead of rmse to determine use which parameters
2025-04-26 12:05:13 +10:00
RREEMMII
0321c26e73
Fix docs of note_fields_check to match changes made in PR #3912 (#3944)
Co-authored-by: Rémi Deloye <remi.deloye@telecom-paris.fr>
2025-04-26 11:55:40 +10:00
Jarrett Ye
e096c462fa
Feat/FSRS-6 (#3929)
* Feat/FSRS-6

* update comment

* add decay to Card

* ./ninja fix:minilints

* pass check

* fix NaN in evaluation

* remove console

* decay should fallback to 0.5 when it's None.

* Update SimulatorModal.svelte

* Update a few comments

* Update FSRS decay defaults to use constants for better maintainability and clarity

* Update rslib/src/storage/card/data.rs
2025-04-25 16:44:34 +10:00
llama
1e6c8b2006
Fix fields with \n being ignored when searching all fields w/o regex (#3943)
* add singleline flag to regex when searching all fields

* update test
2025-04-24 20:01:10 +10:00
Luc Mcgrady
e861364092
Fix/Calculate missing memory states on simulate (#3940)
* Fix: Recalculate memory states on simulate

* Fix: Wrong cards included

* Save states to cards

* ./check

* Update rslib/src/scheduler/fsrs/simulator.rs
2025-04-24 19:32:31 +10:00
Arthur Milchior
7bebcad864
Some documentation and reduce copy/paste (#3917)
* NF: document that cloze number are kept as they are in the field

I needed to know because {{c1 generate card 0 for example. And storing
the card ordinal would have been another consistent choice.

* NF: introduce method that return the cloze number in fields

This slightly reduce code duplication.

* Apply suggestions from code review
2025-04-24 19:02:11 +10:00
Arthur Milchior
efaaae8ce4
Cloze button get disabled outside of cloze field (#3879)
* NF: replace `disabled` by `enabled`

This allows to remove the negations and, in my opinion, make the code
easier to understand and edit.

* Cloze button get disabled outside of cloze field

More specifically, if the user focus in a field that is not a cloze
field, the button are still there but appear as disabled. The shortcut
instead of adding the cloze context shows an alert explaining why this
can't be done.

While this message is already displayed when the user tries to add a
note with cloze in non-cloze field, I suspect it will save time to
stop the user as soon as possible from making mistake. This should
make very clear what is authorized and what is not.

It'll also be a reminder of whether the current field is a cloze or
not.

In order to do this, I added a back-end method (that I expect we may
reuse in ankidroid) to get the index of the fields used in cloze. This
set is sent to the note editor, which propagates it where needed.

In mathjax, the cloze symbol is removed when the selected field is not
a cloze field.
2025-04-24 18:37:41 +10:00
Damien Elmes
dd0abfc200 Don't check collection size on sync to third-party server
Closes #3936
2025-04-23 17:03:04 +10:00
Luc Mcgrady
781a23c6c4
Feat/Ignored before card count (#3910)
* GetIgnoredBeforeCount

* get_card_count_with_ignore_before

* Included / total

* Respect search

* Get frontend hooked up

* Fix: Malformed sql and search

* Variable names

* Added: Alert colours

* i18n

* ./check

* Remove console.log

* Fix: Tooltip showing for default value

* Update ftl/core/deck-config.ftl

Co-authored-by: user1823 <92206575+user1823@users.noreply.github.com>

* Fix: Multiple backend calls

* Message: (Approximately)

* Fix: Bouncing info message

* Added: Change delay

* Added: ignore_before_updated

* ./check

* Fix typing, camelCase and improve wording

* Temporarily enable the check on startup

---------

Co-authored-by: user1823 <92206575+user1823@users.noreply.github.com>
2025-04-15 20:21:54 +10:00
RREEMMII
1fa99c97e4
Add a warning when there is a cloze in "back extra" and "text" is empty (#3912)
* Add a warning when there is a cloze in "back extra" and "text" is empty

Fix #3909

* Disallow non-blank first field card

* Fix Rust ninja check
2025-04-13 14:40:35 +10:00
user1823
e546c6d11f
Improve natural unit conversion for a time b/w 360 to 365 days (#3901)
* Improve natural unit conversion for a time b/w 360 to 365 days

Previously, 363 days would be converted to 12.1 months, which is quite confusing because
- a user would think that if the value is more than 12 months, why it isn't displayed in years
- the value is actually less than a year, which is counterintuitive as 12.1 m suggests a value more than a year.

* precise

* Update time.ts to match timespan.rs

* Add another test

* Use average duration of a month instead

* Update time.ts

* Update test_schedv3.py

* Update time.test.ts
2025-04-13 14:26:34 +10:00
user1823
0f9216c127
Replace some means in Stats with medians (#3900)
* Display median interval in Stats instead of mean

Median is better suited than mean for reporting skewed data.

* Display median ease in Stats instead of mean

* Update difficulty.ts

* Update ease.ts

* Update statistics.ftl

* Format eases.rs

* Remove unused import

* Change Median back to Average in UI

* Revert "Change Median back to Average in UI"

This reverts commit e0c1e3f8e4.

* Preserve the old translations for now (dae)
2025-04-11 19:29:23 +10:00
llama
ccab18b7ba
Modify card rendering output to specify if rendered card is empty (#3890)
* modify render_card to return whether card was empty

* plumbing

* add flag to proto message

* plumbing: pass flag along to PartiallyRenderedCard

* add tests

* Use a custom return type for clarity (dae)
2025-03-31 17:51:28 +07:00
llama
aa5684638b
Improve performance of card rendering parser (#3886)
* refactor parser

* update test

* add tests

* refactor CardNodes

* Increase nested cloze limit to underlying protobuf limit (dae)
2025-03-31 17:38:46 +07:00
Kris Cherven
52781aaab8
Fix superfluous message when a deck is dragged to its parent (#3859)
* Move the solution to the Rust layer

* CONTRIBUTORS fix (1)

* CONTRIBUTORS fix (2)

* Fix CI issues

* Simplify reparenting solution

* Fix reparenting message with tags

* Revert "Fix reparenting message with tags"

This reverts commit 199958c1c5.

* tags: Return None in reparented_name when the name is unchanged
2025-03-31 16:47:56 +07:00
Yuki
acdf486b29
Refactor: Make Load Balancer Optional Throughout Codebase (#3860)
* Refactoring: load balancer

* Update about.py

* Refactoring: load balancer

* Update about.py

* Clean the code

* Remove config check from get_scheduling_states

* Backend method for the load balancer

* Refactor backend method for the load balancer
2025-03-26 23:19:28 +10:00
llama
45bb56808a
Fix deck day limits incorrectly being carried over when importing (#3878)
* re-export DayLimit

* add and use DeckContext::maybe_correct_day_limits

* update existing test

* add test

* small tweaks

* refactor

* refactor test
2025-03-25 00:45:09 +07:00
llama
886c5795d4
Fix panic when clearing today limits on the day collection was made (#3877)
* fix panic on clearing today limits on the day collection was made

* avoid possible overflow

* clear future today limits
2025-03-25 00:24:11 +07:00
Jarrett Ye
a4e0a0824b
Fix/out of index (#3872) 2025-03-25 00:04:25 +07:00
Jarrett Ye
d52889f45c
Feat/simplified relearning steps logic with updated FSRS training API (#3867)
* Feat/simplified relearning steps logic with updated FSRS training API

* Update params.rs

* use ComputeParametersInput

* update fsrs-rs dependency

* update cargo/format/rust-toolchain
2025-03-20 14:04:38 +07:00
Jarrett Ye
5d7f6b25c0
Improve performance of stats revlog entries with memory state (#3866)
* improve performace of stats_revlog_entries_with_memory_state

* format

* move Vec<RevlogEntry> into FsrsItemForMemoryState
2025-03-20 14:02:40 +07:00
llama
d8c83ac075
Loosen csv metadata parsing (#3862)
* add qsv-sniffer crate

* use qsv-sniffer before falling back to old delimiter heuristic

* update test metadata macro

* revert impl

* trim potential suffixed delimiters from non-freeform meta lines

* add test
2025-03-19 18:56:17 +07:00
Damien Elmes
14dc979e44 Fix panic when a preset is missing 2025-03-15 19:40:48 +07:00
Expertium
d53f01064c
Fine-tune load balancer (#3864) 2025-03-15 18:40:17 +07:00
Jarrett Ye
0e31efac08
Feat/grade now (#3840)
* Feat/grade now

* pass ci

* fix from_queue

* Refactor card answering to support from_queue flag

- Add `from_queue` field to `CardAnswer` struct and proto message
- Modify `answer_card_inner` to handle queue updates based on `from_queue`
- Remove `grade_card` method and consolidate card answering logic
- Update related test cases to set `from_queue` flag

* fix current_changes() called when no op set

* Optimize queue updates for batch card processing

- Refactor `grade_now` to collect processed card IDs first
- Add new `update_queues_for_processed_cards` method for efficient batch queue updates
- Improve queue management by removing entries and updating counts in a single pass
- Remove individual queue update method in favor of batch processing

* pass ci

* keep the same style

* remove ineffective code

* remove unused imports
2025-03-15 17:30:40 +07:00
Luc Mcgrady
79b6f658c3
Feat: Simulator suspend after lapse count (#3837)
* Added: Leech suspend to simulator

* Added: leech threshold spin box

* Update git rev

* Added: Save to preset options

* ./check

* Added: "Advanced settings" dropdown

* Removed: Indent

* Added: Easy days

* Added: Sticky header

* Removed: Easy Day updating without saving

* un-nest disclosure

* bump fsrs

* Update a VSCode setting to match recent releases

* Move Easy Days above the Advanced settings

I think it's a bit more logical to have Advanced come last.

* Ensure graph fits inside screen height

* Bump fsrs version
2025-03-15 17:28:15 +07:00
Jarrett Ye
33b8235186
Fix/incorrect initialization of SchedTimingToday in graphs/retrievability.rs (#3857) 2025-03-14 17:06:25 +07:00
Evgeny Kulikov
339bf436d1
Prevent accidental dragging of audio playback buttons and hint links (#3844)
* Add myself to CONTRIBUTORS

* Set draggable="false" attribute on .replay-button

Because currently if a user drags slightly (even unintentionally) upon clicking a play button, play does not happen

* Prevent dragging hint links

Because if a user moves cursor a little after `mousedown`, action (expanding the hint) does not occur. Which might cause issues from accessibility standpoint
2025-03-14 16:47:03 +07:00
Thomas Graves
f5f22edb6a
Don't recalculate remaining steps, conditionally (#3849)
* Don't recalculate remaining steps, conditionally

Bug report reproduction steps:
Create a new profile so that everything is set to default.
Create a new card.
Click Good.
Open deck options and empty learning steps. Save.
No go back and put 1m 10m as LS.
Go back to the card and it should show 10m on the Good button.

Check if old_steps is empty and if it is just use remaining
steps for the new_remaining steps. Add test.

* Update contributers

* Format code

* Fix clippy error

* Use more idiomatic imports
2025-03-14 16:32:28 +07:00
Damien Elmes
9b5da546be Check collection size when syncing
Currently we only check the size on a one-way sync, allowing users
to bypass the limits by incrementally syncing a lot of material.
To prevent this:

- The server now checks if the collection is already oversize,
and forces a one-way sync if it is
- The client checks if the local collection is oversize and refuses
to proceed, so they don't waste time uploading material that will
likely trigger the limit the next time they sync.
2025-03-10 20:28:57 +07:00
Jarrett Ye
a6426bebe2
Feat/support load balance and easy days in FSRS simulator (#3829)
* Feat/support load balance and easy days in FSRS simulator

* format

* consider LoadBalancerEnabled

* use fsrs::PostSchedulingFn

* add load balance and easy days to compute_optimal_retention

* move simulator to a pop-over

* fix incorrect simulationNumber when error 500

* Feat: Save to Preset Options

* update tabs when update newPerDay & reviewsPerDay

* don't reset deckSize & daysToSimulate when save options

* fix missing easy days

* plan to support review priority

* Fix graph line rendering with non-scaling stroke

* simplify review priority function with helper wrapper

* fallback to default ReviewPriority for Added & ReverseAdded

* Update ts/routes/deck-options/SimulatorModal.svelte

Co-authored-by: Luc Mcgrady <lucmcgrady@gmail.com>

* Wrap review priority function in Arc for thread-safe sharing

* more granularity for R sorting

* Add graph smoothing option to FSRS simulator

* Improve graph resize handling in FSRS simulator

* simplify review priority calculation

* Add review order selection to FSRS simulator modal

* Refactor review priority function using macro for conciseness

* Add copyright and license header to SimulatorModal.svelte

* cargo clippy

* ./ninja fix:eslint

* update fsrs-rs

* Update FSRS dependencies and refactor load balancing functions

- Update fsrs-rs dependency to latest commit
- Modify retention and simulator modules to use Arc instead of Box
- Update function signatures and imports in simulator module
- Simplify review card order handling with direct enum usage

* resolve reviewed changes

* replace .unwrap() with ?

* move simulating into SimulatorModal

* add (crate) to interval_to_weekday

* Update FsrsOptions.svelte

* format

---------

Co-authored-by: Luc Mcgrady <lucmcgrady@gmail.com>
2025-02-27 10:53:01 +07:00
Damien Elmes
2727cf39b2 Update to Rust 1.85
Edition update to follow later
2025-02-21 10:42:42 +07:00
Jarrett Ye
59e143ec25
Feat/support load balance and easy days in rescheduling (#3815)
* Feat/support load balance and easy days in rescheduling

* ./ninja fix:minilints

* apply clippy

* reuse calculate_easy_days_modifiers()

* consider LoadBalancerEnabled

* move calculate_easy_days_modifiers out of struct

* improve naming & add comments

* apply clippy

* reschedule if easy days settings are changed

* Minor simplification

* refactor to share code between load balancer and rescheduler

* intervals_and_params -> intervals_and_weights

* find_best_interval -> select_weighted_interval

* cargo clippy

* add warning about easyDaysChanged

* compare arrays directly

* Don't show warning if fsrs+rescehdule is already enabled

---------

Co-authored-by: Damien Elmes <gpg@ankiweb.net>
Co-authored-by: Jake Probst <jake.probst@gmail.com>
2025-02-18 13:44:00 +07:00
Jarrett Ye
54679c5779
Fix/disable FSRS short-term scheduler if w[17] or w[18] is zero (#3788)
* Fix/disable FSRS short-term scheduler if w[17] or w[18] is zero

* fix bracket

* rename variable
2025-02-06 14:24:40 +07:00
Damien Elmes
92b1144d97 Bump Rust to 1.84
+ fix new warnings/lints
+ update pyo3 to fix some other warnings
2025-01-26 18:51:21 +11:00
Damien Elmes
5c84a0cb5e
Fall back to SM2 relative order when memory state missing (#3771)
Closes #3770
2025-01-26 17:26:46 +11:00
Jarrett Ye
43e860783b
Fix/re-optimize FSRS if short-term param is weird (#3742)
* Fix/re-optimize FSRS if short-term param is weird

* Reset progress when another run is required (dae)

* only count the same-day steps

* Fix flicker when optimizing again (dae)
2025-01-26 10:42:17 +11:00
Luc Mcgrady
f038d6726a
Fix: Simulator Ignores New Cards Already Introduced (#3760)
* Subtract introduced:1 count from learn count of first day of simulator.

* Fix: Cards filtered

* Tidy up

* Fix: Cards filtered (2)

* ./check

* Removed unnecessary filter

* Fix: Doesn't work for real new cards

* ./check

* Fix: .is_none()

* Limit to 1 day

* Removed "days_to_simulate" argument from convert
2025-01-25 21:16:25 +11:00
user1823
b80384c715
More accurate sorting by R (#3747)
* Match calc of relative overdueness in SM2 and FSRS

* Fix calculation of FSRS relative overdueness

* Improve readability by avoiding double negative

* Move comment line
2025-01-25 21:15:49 +11:00
llama
9b2987b4a8
Fix numeric deck and notetype names being treated as ids when importing csv (#3748)
* fallback to treating deck and notetype ids as names

* add test for metadata
2025-01-25 20:13:30 +11:00
llama
873c4e617d
Recognise and check for media referenced in <source> tags (#3763)
* recognise and check <source> tags for media

* add test
2025-01-25 10:16:24 +03:00
Damien Elmes
28ba578fc7 Fix invalid reschedule revlog entries
https://forums.ankiweb.net/t/statistics-messed-up-after-fsrs-reschedule/54622

Caused by syncing the revlogs in a normal sync to a client that doesn't
understand them yet - they end up using the default for RevlogReviewKind
instead, which is 0.
2025-01-24 19:06:50 +11:00
Abdo
3acca96ed8
Fix issue in regex for underscored CSS imports (#3728)
* Use lazy quantifier in UNDERSCORED_CSS_IMPORTS regex

* Add test
2025-01-17 15:48:58 +11:00
user1823
c35237c94d
Don't treat manually scheduled cards with no reps as new cards (#3727)
Complements the change in https://github.com/ankitects/anki/pull/3639, ensuring that scheduler and rescheduling produce the same results.
2025-01-17 15:48:41 +11:00
user1823
5ef2328ea4
Clear memory states during bulk action if item is None (#3717)
* Clear memory states during bulk action if item is None

Prevents issues like https://forums.ankiweb.net/t/suggestion-copy-card-debug-info-button/54206/10 and https://github.com/ankitects/anki/issues/3634

* Fix entries not being removed if ignore_before_date after the last grade

* Fix test failure

* Also clear memory states when rescheduling using FSRS helper add-on if item is None
2025-01-15 20:49:15 +11:00
Damien Elmes
39e293b27d Increase allowed nesting level
Making it configurable would be complicated, so this just restores
the limit to close to the protobuf limit we were butting up against
for now.

Related: #3637
2025-01-13 16:03:27 +11:00
Abdo
e98a597b4d
Fix flaky tests (#3724) 2025-01-13 13:56:52 +11:00
llama
2a1448bc45
Fix newer notes incorrectly being skipped when importing successive exports (#3693)
* add Note::set_modified_with_mtime

* add struct for Collection::update_note_inner_without_cards's args

* refactor Collection::update_note_inner_without_cards to use the arg struct

* add Collection::update_note_inner_without_cards_using_mtime

* use incoming note's mtime when updating notes during import
2025-01-13 13:42:44 +11:00
llama
afd7fca4cb
fix csv columns breaking when not contiguous (#3690) 2025-01-13 13:42:31 +11:00
llama
ef94bf1cb0
Add support for html comments to template syntax (#3662)
* add support for comments to templates

* add tests

* add support for comments to CardLayout

* fix lints

* revert current impl

* extract parsing logic from legacy_text_token

* add support for comments to templates

* add tests

* refactor take_until_handlebar_start_or

* remove redundant rest

* Require full subclause match when locating next token (dae)

* Rework legacy template handling (dae)

The handlebar parser is now an instance method of a TemplateMode
enum, allowing us to avoid duplicate code for the legacy code path,
and the necessity to box up the iterator.

This does result in a change in behaviour: when the user has specified
the alternate syntax, the standard syntax will no longer be accepted.

* Remove stale comment (dae)
2025-01-09 23:35:48 +11:00
llama
b6d7bb190d
Fix IO editor always starting in "hide all, guess one" mode (#3709)
* update backend

* set hideAllGuessOne in mask editor instead
2025-01-09 23:14:02 +11:00
Jarrett Ye
c4ad27a2db
Feat/support new cards ignore review limit in simulator (#3707)
* Feat/support new cards ignore review limit in simulator

* ./ninja fix:minilints & ./ninja format

* use published crate

* make newCardsIgnoreReviewLimit reactive

* format

---------

Co-authored-by: Damien Elmes <gpg@ankiweb.net>
2025-01-09 22:49:13 +11:00
Jarrett Ye
39bf29e1a6
Fix/last date of existing card should not be positive in simulation (#3667)
* Fix/last date of existing card should not be positive in simulation

* update fsrs-rs to v1.4.9

* ./ninja fix:minilints
2025-01-08 23:05:37 +11:00
Jake Probst
aaf8b4dddb
Easy days: revisited (#3661)
* new easy days algorithm

* take easy day percent totals in account when determining reduced scheduling

* Use variant method to avoid repeated mapping to a constant (dae)

It was probably not worth the time I took to change this ^_^;
2025-01-08 21:56:27 +11:00
Jarrett Ye
58bcab2484
Sort FSRSItems by RevlogId for training (#3660)
* Sort FSRSItems by RevlogId for training

* update fsrs-rs v1.5.0
2025-01-08 21:32:00 +11:00
sorata
f1a5808d83
Don't Exclude Suspended Cards from Retreivability Graph (#3665)
* Revert "Fix/skip suspended cards in graphs context retrievability (#3518)"

This reverts commit 939cc5a268.

* apply suggestions
2025-01-05 01:30:43 +03:00
user1823
7fa544df9b
Add some unit tests (#3678)
* Add some unit tests

Covers most of the cases encountered in https://github.com/ankitects/anki/pull/3639

* Format

* Update params.rs

Makes the test more robust.

* Update params.rs

When training, the first FSRS item is removed. That's why none of the other tests includes it.

Co-authored-by: Jarrett Ye <jarrett.ye@outlook.com>

* Improve naming

* Fix typo

---------

Co-authored-by: Jarrett Ye <jarrett.ye@outlook.com>
2025-01-04 17:26:23 +03:00
Jarrett Ye
e7fff9eba0
Fix/forget to update memory state during relearning (#3648) 2024-12-19 00:33:04 +11:00
Jake Probst
69e699dc13
Fix easy days causing load balancer to disproportionately schedule graduates to the furthest day (#3643)
* don't do easy days calculation if all days are the same ease
2024-12-18 23:49:59 +11:00
Jarrett Ye
474dbc2812
Fix/fallback to non-manual entry when first_of_last_learn_entries non found (#3639)
* Fix/fallback to non-manual entry when first_of_last_learn_entries non found

* refactor single_card_revlog_to_item(s)

* update unit test of bypassed_learning_is_handled

* move comment line

* remove first_relearn_entries

* skip cram entry

* only pick non_manual_entries after ignore date

* fallback to non_manual_entries if the first learning step is before the ignore date

* pass ci

* update ignore_before_date_between_learning_steps_when_reviewing

* shorten the comment

* Minor refactoring

- fsrs_items_for_memory_state - fsrs_items_for_memory_states
- single_card_revlog_to_item -> fsrs_item_for_memory_state
(to match fsrs_items_for_training)
- single_card_revlog_to_items -> reviews_for_fsrs
- Use struct instead of tuple for reviews_for_fsrs output
- Don't return count, since we're already returning the filtered list

* More renaming/comment tweaks

- non_manual_entries -> first_user_grade_idx
- change comments to reflect the fact that we're working backwards
- Use "user-graded" rather than "non-manual"

* Add extra unit test

* Some wording tweaks
2024-12-17 23:34:19 +11:00
a.r
1fb5e99efc
typeanswer: [type:nc] - use nfkd again (#3627) 2024-12-14 21:53:48 +11:00
OuOu2021
cee04bf20c
Apply gradient effect to forgetting curve (#3604)
* Add gradient color for forgetting curve

* Add desiredRetention prop for CardInfo

* update CONTRIBUTORS

* Formatting

* Tweak range of gradient

* Tweak: salmon -> tomato

* Get desired retention of the card from backend

* Add a reference line for desired retention

* Fix: Corrected the steel blue's height & Hide desired retention line when yMin is higher than desiredRetentionY

* Add y axis title

* Show desired retention in the tooltip

* I18n: improve translation and vertical text display

* Revert rotatation&writing-mode of vertical title

* Tweak font-size of y axis title

* Fix: delete old desired retention line when changing duration

* Update ftl/core/card-stats.ftl

---------

Co-authored-by: Damien Elmes <dae@users.noreply.github.com>
2024-12-09 17:44:05 +11:00
Jarrett Ye
6874440cda Fix/incorrect memory state inference for incomplete review history (#3599)
make ci happy
2024-11-26 21:57:09 +10:00
Jarrett Ye
9a013d8601
Fix/FSRS progress sometime shows 0 reviews (#3591)
* Fix/FSRS progress sometime shows 0 reviews

* wait for progress_thread

* set 200ms timeout
2024-11-24 20:52:12 +10:00
Damien Elmes
01c368654b Remove remaining remnants of unused error; fix CI 2024-11-19 15:26:02 +10:00