mirror of
https://github.com/ruikurenaii/performium.git
synced 2026-07-22 12:50:33 +00:00
fix saving performance to file bug + add use of weighted pp
This commit is contained in:
parent
b29765c2ee
commit
a3a329b50e
3 changed files with 8 additions and 3 deletions
|
|
@ -3,9 +3,11 @@
|
|||
// import { PerformanceEntry } from "../interfaces/performanceEntry";
|
||||
// import { getTopPerformanceEntries } from "./getTopPerformanceEntries";
|
||||
import PerformiumPlugin from "../main";
|
||||
import { getWeightedPP } from "./weightPP";
|
||||
import { App } from "obsidian";
|
||||
|
||||
// it may not be used or i don't know.
|
||||
export function generateFact(plugin: PerformiumPlugin): string {
|
||||
export async function generateFact(plugin: PerformiumPlugin, app: App): Promise<string> {
|
||||
const array = [
|
||||
`As of January 22, 2026, the old fun facts were removed in favor of the new ones!`,
|
||||
`As of this update, Performium is being developed in Arch Linux!`,
|
||||
|
|
@ -52,6 +54,9 @@ export function generateFact(plugin: PerformiumPlugin): string {
|
|||
// count the total number of text lines
|
||||
array.push(`There are a total of ${array.length + 1} fun facts to encounter! Try to find them all!`);
|
||||
|
||||
// make use of the newly-made weighted pp
|
||||
array.push(`From all the performance calculations you have executed, weighting them all would give you a total amount of ${new Intl.NumberFormat().format(Math.trunc(await getWeightedPP(app)))}`);
|
||||
|
||||
let fact: string = array[Math.floor(Math.random() * array.length)];
|
||||
return fact;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { App } from "obsidian";
|
||||
|
||||
export async function savePerformanceToFile(app: App, value: number) {
|
||||
const filePath = `.${app.vault.configDir}/pp-entries.json`;
|
||||
const filePath = `${app.vault.configDir}/pp-entries.json`;
|
||||
const adapter = app.vault.adapter;
|
||||
|
||||
const now = new Date();
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ export class PerformiumSettingsTab extends PluginSettingTab {
|
|||
|
||||
// const installTimestamp = this.plugin.settings.installTimestamp ?? Date.now();
|
||||
|
||||
let factText: string = generateFact(this.plugin);
|
||||
let factText: string = await generateFact(this.plugin, this.app);
|
||||
|
||||
// const totalTime = installTimestamp - Date.now();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue