Skip to content

Commit

Permalink
Release 0.0.8
Browse files Browse the repository at this point in the history
  • Loading branch information
saertna committed Nov 9, 2023
1 parent 7185c86 commit 0696454
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 4 deletions.
5 changes: 2 additions & 3 deletions main.js

Large diffs are not rendered by default.

Binary file modified obsidian-gamified-pkm/obsidian-gamified-pkm.zip
Binary file not shown.
34 changes: 33 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,26 @@ export default class gamification extends Plugin {
//this.setSettingString('weeklyNoteCreationDate', window.moment().format('DD.MM.YYYY'))
//this.setSettingString('weeklyNoteCreationDate', window.moment().format('DD.MM.YYYY'))
//await this.saveSettings();
new ModalBooster(this.app, ` `, this).open();

//new ModalBooster(this.app, ` `, this).open();

//this.updateAvatarPage(this.getSettingString('avatarPageName'))


// Example CSV string
/*const csvString = "Brainiac Trailblazer,2023-09-07,20\nSavvy Scholar,2023-08-15,15";
// Parse the CSV string
const badgeDict = parseBadgeCSV(csvString);
// Access badge information
//console.log(badgeDict["Brainiac Trailblazer"]);
for (const badgeName in badgeDict) {
if (badgeDict.hasOwnProperty(badgeName)) {
const badgeInfo = badgeDict[badgeName];
console.log(`Badge: ${badgeName}, Date: ${badgeInfo.date}, Level: ${badgeInfo.level}`);
}
}*/
});
}

Expand Down Expand Up @@ -1366,6 +1384,20 @@ function rateDirectionForStatusPoints(ratingCurrent: string, ratingNew: number):



function parseBadgeCSV(csvString: string): Record<string, { date: string, level: number }> {
const badgeDict: Record<string, { date: string, level: number }> = {};
const rows = csvString.split('\n');
for (const row of rows) {
const [badgeName, dateReceived, level] = row.split(',');

if (badgeName && dateReceived && level) {
badgeDict[badgeName] = { date: dateReceived, level: parseInt(level, 10) };
}
}
return badgeDict;
}





Expand Down

0 comments on commit 0696454

Please sign in to comment.