WritingLog.h header

#include <ew/core/WritingLog.h>

Namespace ew::core

WritingLog class

class ew::core::WritingLog

A per-day log of words written in a project, backing the productivity analytics (words today, writing streaks, totals). Days with no writing are simply absent. Value type; the project owns one and it is persisted with the project metadata.

Members

void ew::core::WritingLog::addWords(QDate day, int words)

Adds words to the total recorded for day. Non-positive values are ignored (the log tracks words added, not deletions).

int ew::core::WritingLog::wordsOn(QDate day) const

The words recorded on day, or 0 if none.

int ew::core::WritingLog::totalWords() const

The total words recorded across all days.

int ew::core::WritingLog::daysWritten() const

The number of days with any words recorded.

int ew::core::WritingLog::currentStreak(QDate today) const

The current writing streak relative to today: the run of consecutive days with words ending at today, or – if nothing is logged for today yet – ending at the day before. Zero when the streak is broken.

const std::map< QDate, int > & ew::core::WritingLog::days() const

The per-day entries (day -> words), ascending by date.