Skip to content

Commit

Permalink
Fixed bug preventing stats being shown (previously introduced in branch
Browse files Browse the repository at this point in the history
  • Loading branch information
ronzulu committed Jul 16, 2024
1 parent 9c5d10f commit f44bea6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
11 changes: 6 additions & 5 deletions src/gui/StatsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { textInterval } from "src/algorithms/osr/NoteScheduling";
import { t } from "src/lang/helpers";
import { Stats } from "../stats";
import { CardListType } from "src/Deck";
import { OsrCore } from "src/OsrCore";

Chart.register(
BarElement,
Expand All @@ -37,12 +38,12 @@ Chart.register(
);

export class StatsModal extends Modal {
private plugin: SRPlugin;
private osrCore: OsrCore;

constructor(app: App, plugin: SRPlugin) {
constructor(app: App, osrCore: OsrCore) {
super(app);

this.plugin = plugin;
this.osrCore = osrCore;

this.titleEl.setText(`${t("STATS_TITLE")} `);
this.titleEl.addClass("sr-centered");
Expand Down Expand Up @@ -70,7 +71,7 @@ export class StatsModal extends Modal {
contentEl.style.textAlign = "center";

// Add forecast
const cardStats: Stats = this.plugin.cardStats;
const cardStats: Stats = this.osrCore.cardStats;
let maxN: number = cardStats.delayedDays.getMaxValue();
for (let dueOffset = 0; dueOffset <= maxN; dueOffset++) {
cardStats.delayedDays.clearCountIfMissing(dueOffset);
Expand Down Expand Up @@ -170,7 +171,7 @@ export class StatsModal extends Modal {
);

// Add card types
const totalCardsCount: number = this.plugin.deckTree.getDistinctCardCount(
const totalCardsCount: number = this.osrCore.reviewableDeckTree.getDistinctCardCount(
CardListType.All,
true,
);
Expand Down
4 changes: 2 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default class SRPlugin extends Plugin {
private nextNoteReviewHandler: NextNoteReviewHandler;

async onload(): Promise<void> {
console.log("onload: Branch: feat-878-support-multiple-sched, Date: 2024-07-04");
console.log("onload: Branch: feat-878-support-multiple-sched, Date: 2024-07-16");
await this.loadPluginData();

this.initLogicClasses();
Expand Down Expand Up @@ -278,7 +278,7 @@ export default class SRPlugin extends Plugin {
callback: async () => {
if (!this.osrAppCore.syncLock) {
await this.sync();
new StatsModal(this.app, this).open();
new StatsModal(this.app, this.osrAppCore).open();
}
},
});
Expand Down

0 comments on commit f44bea6

Please sign in to comment.