Skip to content

fix(score): show selected period label#845

Open
TimeToBuildBob wants to merge 1 commit into
ActivityWatch:masterfrom
TimeToBuildBob:bob/fix-score-period-label
Open

fix(score): show selected period label#845
TimeToBuildBob wants to merge 1 commit into
ActivityWatch:masterfrom
TimeToBuildBob:bob/fix-score-period-label

Conversation

@TimeToBuildBob
Copy link
Copy Markdown
Contributor

Summary

  • replace the Score visualization's hardcoded "today" text with the selected activity period label
  • keep the label derived from the same query timeperiod used by the score data

Fixes #844.

Verification

  • npx eslint --ext .vue,.js,.ts src/visualizations/Score.vue
  • npm run build

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 25, 2026

Greptile Summary

This PR fixes a UX bug where the Score visualization always displayed "today" regardless of the selected activity period. A new score_period_label computed property reads query_options.timeperiod from the Pinia activity store and formats it with the existing periodReadable utility, falling back to 'selected period' when no timeperiod is set.

  • Template change: "Your total score today is:""Your total score for {{ score_period_label }} is:", driven by a new computed property.
  • New computed: score_period_label accesses useActivityStore().query_options?.timeperiod (consistent with the existing categories_with_score pattern) and delegates formatting to periodReadable, which already handles day/week/month/year/multi-period formatting.

Confidence Score: 5/5

Safe to merge — the change is a minimal, focused fix to a display string with a well-tested fallback path.

The change adds a single computed property that follows the same store-access pattern already used elsewhere in the component. The optional-chaining fallback handles the null/undefined case correctly, periodReadable already covers all standard period lengths, and there are no mutations or side effects introduced.

No files require special attention.

Important Files Changed

Filename Overview
src/visualizations/Score.vue Replaces hardcoded "today" string with a reactive score_period_label computed property that calls periodReadable(timeperiod) from the activity store, with a safe fallback to 'selected period' when the timeperiod is unavailable.

Sequence Diagram

sequenceDiagram
    participant User
    participant Score.vue
    participant ActivityStore
    participant periodReadable

    User->>Score.vue: Selects activity period
    Score.vue->>ActivityStore: useActivityStore().query_options?.timeperiod
    ActivityStore-->>Score.vue: "TimePeriod | undefined"
    alt timeperiod available
        Score.vue->>periodReadable: periodReadable(timeperiod)
        periodReadable-->>Score.vue: formatted label (e.g. "2024-01-15")
    else timeperiod unavailable
        Score.vue-->>Score.vue: "selected period" (fallback)
    end
    Score.vue-->>User: "Your total score for <label> is:"
Loading

Reviews (1): Last reviewed commit: "fix(score): show selected period label" | Re-trigger Greptile

@codecov
Copy link
Copy Markdown

codecov Bot commented May 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 34.38%. Comparing base (be8e249) to head (b01f914).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #845   +/-   ##
=======================================
  Coverage   34.38%   34.38%           
=======================================
  Files          36       36           
  Lines        2114     2114           
  Branches      403      408    +5     
=======================================
  Hits          727      727           
  Misses       1308     1308           
  Partials       79       79           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@0xbrayo
Copy link
Copy Markdown
Member

0xbrayo commented May 25, 2026

Works as expected

@TimeToBuildBob
Copy link
Copy Markdown
Contributor Author

CI is green on b01f914, Greptile is clean, and the behavior has been manually verified in-thread.

This should be ready for maintainer merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Productivity score viz always says Today

2 participants