Datahub Collected filter labels rolling windows as This week, This month and This year
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 88/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- react, typescript
- Domain
- frontend
Research direction
Start with apps/web/src/routes/_app/datahub/subjects/index.tsx, especially the option labels at lines 249–256 and presetMinDate at lines 61–80; compare them with datahub.visualization.timeframeOptions. Run the named subjects test, apps/web/src/routes/_app/datahub/subjects/__tests__/index.test.tsx, to check the labels against the rolling windows. Done when the labels accurately describe the applied periods, with the relevant test passing.
Written by the indexing model from the issue text.
Description
The datahub's "Collected" filter offers "This week", "This month" and "This year", but these apply rolling windows: the past 7 days, the past month and the past 12 months (presetMinDate subtracts 7 days, 1 month and 1 year from now). Read as calendar periods, the labels select the wrong subjects. On 7 October, "This month" also includes subjects last seen on 8–30 September, and on 5 January "This year" includes most of the previous year. The other options are worded as spans ("3 months", "6 months", "2 years"), and the subject Graph and Table tabs label the same computation "Past Month" / "Past Year" (datahub.visualization.timeframeOptions). A user narrowing a cohort to "this month" for a monthly report gets a different set of subjects than they asked for, with nothing to show the window is rolling.
Where
apps/web/src/routes/_app/datahub/subjects/index.tsx:249-256:
<option value="all">{t({ en: 'Any time', es: 'Cualquier fecha', fr: 'Toute période' })}</option>
<option value="pastWeek">{t({ en: 'This week', es: 'Esta semana', fr: 'Cette semaine' })}</option>
<option value="pastMonth">{t({ en: 'This month', es: 'Este mes', fr: 'Ce mois-ci' })}</option>
<option value="pastThreeMonths">{t({ en: '3 months', es: '3 meses', fr: '3 mois' })}</option>
<option value="pastSixMonths">{t({ en: '6 months', es: '6 meses', fr: '6 mois' })}</option>
<option value="pastYear">{t({ en: 'This year', es: 'Este año', fr: 'Cette année' })}</option>
and the windows they map to, index.tsx:61-80:
case 'pastMonth':
return monthsAgo(1);
// ...
case 'pastWeek':
return new Date(new Date(now).setDate(now.getDate() - 7));
case 'pastYear':
return yearsAgo(1);
Reproduce
- Have a subject whose last record was collected on 20 September and another on 3 October.
- On 7 October, open Datahub → Subjects → Filters and set Collected to "This month".
Actual: both subjects are listed.
Expected: only the subject collected in October is listed, or, if the rolling window is intended, the option reads "Past month" (and "Past week", "Past year") like the subject graph's timeframe menu.
Tests
apps/web/src/routes/_app/datahub/subjects/__tests__/index.test.tsx:it('should label the rolling collected windows as past periods, so they are not read as calendar months'), or, if calendar periods are chosen,it('should start the This month window on the first of the month')with fake timers.testing/src/specs/datahub.spec.ts: select the month preset and assert the option text matches the window applied.
Suggested fix
Relabel the three options "Past week", "Past month", "Past year" (es: "Última semana", "Último mes", "Último año"; fr: "Semaine écoulée", "Mois écoulé", "Année écoulée", matching datahub.json), so all presets describe spans. Alternatively, keep the labels and compute calendar boundaries in presetMinDate.
- Dominant language
- TypeScript
- Stars
- 119
- Forks
- 19
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 56
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from DouglasNeuroInformatics/OpenDataCapture
-
Area: Playground Bug Difficulty: Low Good First Issue Priority: Low
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
DouglasNeuroInformatics/OpenDataCapture#1805 ·
Maintainers usually reply within 1 day
-
Area: Instruments Bug Difficulty: Low Priority: Low
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
DouglasNeuroInformatics/OpenDataCapture#1801 ·
Maintainers usually reply within 1 day
-
Area: Instruments Bug Difficulty: Low Good First Issue Priority: Low
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
DouglasNeuroInformatics/OpenDataCapture#1800 ·
Maintainers usually reply within 1 day
-
Area: Instruments Bug Difficulty: Low Good First Issue Priority: Low
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
DouglasNeuroInformatics/OpenDataCapture#1799 ·
Maintainers usually reply within 1 day
-
Area: Instruments Bug Difficulty: Low Performance Priority: Medium
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
DouglasNeuroInformatics/OpenDataCapture#1795 ·
Maintainers usually reply within 1 day
All issues in DouglasNeuroInformatics/OpenDataCapture
Similar issues
-
[bug] diagnostics.dumpBody:Buffer 形态请求(透传 lane)跳过 dumps/ 落盘,仅留 raw/-unknown-Possibly taken @ranxianglei claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
ranxianglei/billion-context#2421 · 2 comments ·
Maintainers usually reply within 1 day
-
pending triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
nuxt/test-utils#1842 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
MoonshotAI/kimi-code#4146 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
farbenmeer/tapi#531 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day