Skip to content

Commit

Permalink
Added Compute Heat option
Browse files Browse the repository at this point in the history
  • Loading branch information
Canna71 committed Oct 13, 2023
1 parent 59c3046 commit e4657b5
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion manifest-beta.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "chronology",
"name": "Chronology",
"version": "1.1.9",
"version": "1.1.10",
"minAppVersion": "0.15.0",
"description": "Enables to have a calendat and a timeline of the activities",
"author": "Gabriele Cannata",
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "chronology",
"name": "Chronology",
"version": "1.1.9",
"version": "1.1.10",
"minAppVersion": "0.15.0",
"description": "Provides a calendar and a timeline of the notes creation and modification",
"author": "Gabriele Cannata",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "obsidian-chronologyn",
"version": "1.1.9",
"version": "1.1.10",
"description": "Obsidian.md plugin that Provides a calendar and a timeline of the notes creation and modification",
"main": "main.js",
"scripts": {
Expand Down
5 changes: 5 additions & 0 deletions src/ChronologySettingTab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ export class ChronologySettingTab extends PluginSettingTab {
})
})

// add seting for computeHeat
this.createToggle(containerEl, "Compute Heat",
"Compute heat for each day in the calendar",
"computeHeat"
);

}

Expand Down
3 changes: 2 additions & 1 deletion src/TimeIndex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export class TimeIndex implements ITimeIndex {
getNotesForCalendarItem(item: CalendarItem, sortingStrategy = SortingStrategy.Mixed, desc = true): NoteAttributes[] {
const allNotes = this.app.vault.getMarkdownFiles();
const { fromTime, toTime } = item.getTimeRange();

let notes = allNotes.reduce<NoteAttributes[]>((acc, note) => {
let createdTime = moment(note.stat.ctime);
let modifiedTime = moment(note.stat.mtime);
Expand Down Expand Up @@ -161,8 +160,10 @@ export class TimeIndex implements ITimeIndex {


getHeatForDate(date: string | moment.Moment): number {
if(!getChronologySettings().computeHeat) return 0;
const mom = moment(date);


const items = this.getNotesForCalendarItem(new CalendarItem(mom));

// this formula is logaritmic
Expand Down
4 changes: 3 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ interface ChronologyPluginSettings {
firstDayOfWeek: number;
creationDateAttribute?: string;
modifiedDateAttribute?: string;
computeHeat?: boolean;
}

const DEFAULT_SETTINGS: ChronologyPluginSettings = {
Expand All @@ -25,7 +26,8 @@ const DEFAULT_SETTINGS: ChronologyPluginSettings = {
groupItemsInSameSlot: false,
firstDayOfWeek: -1, // locale default
creationDateAttribute: "",
modifiedDateAttribute: ""
modifiedDateAttribute: "",
computeHeat: true
}

let expSettings: ChronologyPluginSettings;
Expand Down

0 comments on commit e4657b5

Please sign in to comment.