Skip to content

Commit

Permalink
fix lint error
Browse files Browse the repository at this point in the history
  • Loading branch information
Newdea committed Feb 18, 2024
1 parent d1ce86f commit e8bf3f3
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions src/algorithms/balance/balance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function balance(
// replaces random fuzz with load balancing over the fuzz interval
const beforeIntvl = interval;
let isChange = false;
let dueDates = dueDatesDict[type];
const dueDates = dueDatesDict[type];
if (dueDates !== undefined) {
interval = Math.round(interval);
// const due = window.moment().add(interval,"days");
Expand All @@ -44,7 +44,7 @@ export function balance(
} else if (dueDates[interval] >= lowestCount) {
// disable fuzzing for small intervals
if (interval >= 1) {
let fuzz = getFuzz(interval);
const fuzz = getFuzz(interval);

const originalInterval = interval;
outer: for (let i = 1; i <= fuzz; i++) {
Expand Down
10 changes: 5 additions & 5 deletions src/algorithms/balance/postpone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export function postponeItems(items: RepetitionItem[], days?: number): Repetitio
const now = Date.now();
const newdue: number = days ? now + days * DateUtils.DAYS_TO_MILLIS : undefined;
let fltItems = items.filter((item) => item.isTracked);
let safe_fltItems = fltItems
const safe_fltItems = fltItems
.filter((item) => item.nextReview < DateUtils.StartofToday)
.sort((a, b) => currentRetention(a) - currentRetention(b))
// https://github.com/open-spaced-repetition/fsrs4anki-helper/blob/58bcfcf8b5eeb60835c5cbde1d0d0ef769af62b0/schedule/postpone.py#L73
Expand Down Expand Up @@ -33,10 +33,10 @@ function currentRetention(item: RepetitionItem) {
function postpone(items: RepetitionItem[], newdue?: number): RepetitionItem[] {
let cnt = 0;
items.map((item) => {
let newitvl: number,
olastview = item.hasDue
? item.nextReview - item.interval * DateUtils.DAYS_TO_MILLIS
: Date.now();
let newitvl: number;
const olastview = item.hasDue
? item.nextReview - item.interval * DateUtils.DAYS_TO_MILLIS
: Date.now();

if (newdue) {
newitvl = newdue - olastview;
Expand Down
11 changes: 4 additions & 7 deletions src/algorithms/balance/reschedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ function reschedule_default(items: RepetitionItem[]) {
let reCnt = 0;

items.map((item) => {
let newitvl: number;

let interval = item.interval * 9 * (1 / 0.9 - 1);
newitvl = Math.min(Math.max(Math.round(interval), 1), 3650);
const interval = item.interval * 9 * (1 / 0.9 - 1);
const newitvl = Math.min(Math.max(Math.round(interval), 1), 3650);
if (newitvl !== item.interval) {
reCnt++;
item.updateDueByInterval(newitvl);
Expand All @@ -37,13 +35,12 @@ function reschedule_default(items: RepetitionItem[]) {

function reschedule_fsrs(items: RepetitionItem[]) {
let reCnt = 0;
let fsrs = (SrsAlgorithm.getInstance() as FsrsAlgorithm).fsrs;
const fsrs = (SrsAlgorithm.getInstance() as FsrsAlgorithm).fsrs;

items.map((item) => {
let newitvl: number;
if (!item.isTracked) return;
const data = item.data as FsrsData;
newitvl = fsrs.next_interval(data.stability);
const newitvl = fsrs.next_interval(data.stability);
if (newitvl !== data.scheduled_days) {
reCnt++;
item.updateDueByInterval(newitvl);
Expand Down
2 changes: 1 addition & 1 deletion src/algorithms/fsrs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export class FsrsAlgorithm extends SrsAlgorithm {
this.appendRevlog(item, review_log);
}

let nextInterval = data.due.valueOf() - data.last_review.valueOf();
const nextInterval = data.due.valueOf() - data.last_review.valueOf();

return {
correct,
Expand Down
8 changes: 4 additions & 4 deletions src/dataStore/repetitionItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class RepetitionItem {
const newItem = new RepetitionItem();
Object.assign(newItem, item);
if (newItem.isFsrs) {
let data = item.data as FsrsData;
const data = item.data as FsrsData;
data.due = new Date(data.due);
data.last_review = new Date(data.last_review);
}
Expand Down Expand Up @@ -98,7 +98,7 @@ export class RepetitionItem {
* @return {*}
*/
reviewUpdate(result: ReviewResult) {
let newitvl = balance(result.nextReview / DateUtils.DAYS_TO_MILLIS, this.itemType);
const newitvl = balance(result.nextReview / DateUtils.DAYS_TO_MILLIS, this.itemType);
this.nextReview = DateUtils.fromNow(newitvl * DateUtils.DAYS_TO_MILLIS).getTime();
this.timesReviewed += 1;
if (result.correct) {
Expand Down Expand Up @@ -183,7 +183,7 @@ export class RepetitionItem {
// 240212-interval will be used to calc current retention, shoudn't update.
const now = Date.now();
const enableBalance = newdue == undefined;
let oitvl = this.interval,
const oitvl = this.interval,
odue = this.hasDue ? this.nextReview : now;

if (this.isFsrs) {
Expand All @@ -204,7 +204,7 @@ export class RepetitionItem {
let days = Math.max(0, newdue - now) / DateUtils.DAYS_TO_MILLIS;
days = balance(days, this.itemType);
console.debug("days:", days);
let nextInterval = days * DateUtils.DAYS_TO_MILLIS;
const nextInterval = days * DateUtils.DAYS_TO_MILLIS;
newdue = nextInterval + now;
}

Expand Down
9 changes: 6 additions & 3 deletions src/reviewNote/review-note.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,15 @@ export class ReviewNote {
let deckName = Tags.getNoteDeckName(note, settings);

if (
deckName == null ||
(!settings.untrackWithReviewTag && !store.getTrackedFile(note.path)?.isTrackedNote)
(settings.untrackWithReviewTag && deckName == null) ||
(!settings.untrackWithReviewTag &&
deckName == null &&
!store.getTrackedFile(note.path)?.isTrackedNote)
) {
new Notice(t("PLEASE_TAG_NOTE"));
return;
} else if (deckName == null) {
}
if (deckName == null) {
deckName = store.getTrackedFile(note.path)?.lastTag ?? null;
}
return deckName;
Expand Down

0 comments on commit e8bf3f3

Please sign in to comment.