Pomodoro Heat Map

What I’m trying to do

I’m trying to create a pomodoro heat map to track my progress.

Things I have tried

I found some scripts from a reddit post but I can’t seem to get them to work for the life of me.

I’m using the pomodoro with the status bar plug in, dataview plug in, and heat map plug in.

I don’t seem to have a specific log of pomodoros but they are being listed at the end of my daily note so if I can pull the info from those that would be helpful.

Here is the script I was trying to work with:

To pull the data from logs:


<%*
tR = - 🍅 (pomodoro:: ${log.mode}) (duration:: ${log.duration}m) (session:: ${log.session}m) (finished:: ${log.finished}) (begin:: ${log.begin.format()}) - (end:: ${log.end.format()}) (note:: ${log.task?.name ?? ''});
%>

dataview queries:

const pages = dv.pages(‘“Pomodoro Timer Log”’);
const table = dv.markdownTable(
[‘Pomodoro’, ‘Duration’, ‘Begin’, ‘End’, ‘Finished’, ‘Focused’],
pages.file.lists
.filter(item => item.pomodoro)
.sort(item => item.end, ‘desc’)
.map(item => [
item.pomodoro,
${item.duration.as("minutes")} m,
item.begin,
item.end,
item.finished,
item.note
])
);

dv.paragraph(table);

and

const pages = dv.pages(‘“Pomodoro Timer Log”’);
const emoji = “:tomato:”;
dv.table(
[“Date”, “Pomodoros”, “Total”],
pages.file.lists
.filter((item) => item?.pomodoro == “WORK”)
.groupBy((item) => {
if (true) {
let dateObject = new Date(item.end);
return dateObject.toISOString().substring(0, 10);
} else {
return “Unknown Date”;
}
})
.map((group) => {
let sum = 0;
group.rows.forEach((row) => (sum += row.duration.as(“minutes”)));
return [
group.key,
group.rows.length > 5
? ${emoji} ${group.rows.length}
: ${emoji.repeat(group.rows.length)},
${sum} min,
];
})
)

Reddit Post

Thanks for your help!

That’s looking very messed up. Could you please enclose the source text between lines of four backticks so it’s possible to read your current setup?