Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Datahub Collected filter labels rolling windows as This week, This month and This year

Aperta Adatta ai principianti
#1,785 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
88/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
react, typescript
Ambito
frontend

Direzione di ricerca

Inizia da apps/web/src/routes/_app/datahub/subjects/index.tsx, in particolare dalle etichette delle opzioni alle righe 249–256 e da presetMinDate alle righe 61–80; confrontale con datahub.visualization.timeframeOptions. Esegui il test subjects indicato, apps/web/src/routes/_app/datahub/subjects/__tests__/index.test.tsx, per verificare le etichette rispetto alle finestre mobili. Il lavoro è completato quando le etichette descrivono accuratamente i periodi applicati e il test pertinente ha esito positivo.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Area: Web Bug Difficulty: Low Good First Issue Priority: Low

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

  1. Have a subject whose last record was collected on 20 September and another on 3 October.
  2. 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.

Lingua principale
TypeScript
Stelle
119
Fork
19
Merge medio
1g 2h
PR unite (30g)
56

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di DouglasNeuroInformatics/OpenDataCapture

Tutte le issue di DouglasNeuroInformatics/OpenDataCapture

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.