Skip to content

Commit

Permalink
Merge pull request #40 from saertna/package-zip
Browse files Browse the repository at this point in the history
Release 0.0.8
  • Loading branch information
saertna authored Nov 9, 2023
2 parents 0eb9780 + 0696454 commit c3b0834
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 5 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Hello, fellow learners and knowledge seekers! 📚 If you're as passionate about


## Manual installation
1. Download the latest release 🔗 **Plugin Download:** [Obsidian Gamification Plugin](https://github.com/saertna/obsidian-gamified-pkm/releases/tag/0.0.8-beta.2)
1. Download the latest release 🔗 **Plugin Download:** [Obsidian Gamification Plugin](https://github.com/saertna/obsidian-gamified-pkm/releases/tag/0.0.8)
2. Extract the obsidian-gamified-pkm folder from the zip to your vault's plugins folder: <vault>/.obsidian/plugins/
- Note: On some machines the .obsidian folder may be hidden. On MacOS you should be able to press Command+Shift+Dot to show the folder in Finder.
- Note: the files `main.js` and `manifest.json` are the files which you need in this folder.
Expand All @@ -18,6 +18,7 @@ Hello, fellow learners and knowledge seekers! 📚 If you're as passionate about
- `dataview`. In dataview settings enable `Enable JavaScript Queries` and `Enable Inline JavaScript Queries` to display counting in profile.
- `obsidian-charts`
6. in Obsidian hit `CTRL+P` and run command `Initialize gamification ratings`
7. create and improve notes and rate again to increase points

**Embark on a Motivational Journey!**

Expand Down
5 changes: 2 additions & 3 deletions main.js

Large diffs are not rendered by default.

Binary file added 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 c3b0834

Please sign in to comment.