• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

inclusion-numerique / coop-mediation-numerique / ff465997-5449-4f03-b5eb-3f66575f993a

21 Apr 2026 08:25AM UTC coverage: 10.612% (+3.1%) from 7.466%
ff465997-5449-4f03-b5eb-3f66575f993a

push

circleci

marc-gavanier
fix: correct admin fixture IDs and emails

Fix Kevin Troadec ID and email (kevin.troadec@beta.gouv.fr),
fix Adrien Turpin ID to match production database.

699 of 10549 branches covered (6.63%)

Branch coverage included in aggregate %.

2167 of 16457 relevant lines covered (13.17%)

1.99 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/apps/web/src/assistant/groupChatThreadsByPeriod.ts
1
import type { UserChatThreadsList } from '@app/web/assistant/getChatThread'
2

3
const startOfDay = (date: Date): Date => {
×
4
  const d = new Date(date)
×
5
  d.setHours(0, 0, 0, 0)
×
6
  return d
×
7
}
8

9
const filterByDateRange =
10
  (from: Date, to?: Date) => (thread: { updated: Date }) =>
×
11
    to ? thread.updated >= from && thread.updated < to : thread.updated >= from
×
12

13
// Groupe les messages pour la sidebar
14
// "Aujourd'hui
15
// "Hier
16
// "7 derniers jours"
17
// "30 derniers jours"
18
export const groupChatThreadsByPeriod = <
×
19
  T extends Pick<UserChatThreadsList[number], 'updated'>,
20
>(
21
  chatThreadHistory: T[],
22
  _internal?: { now: Date }, // for testing only
23
): {
24
  period: string
25
  threads: T[]
26
}[] => {
27
  const now = _internal?.now ?? new Date()
×
28

29
  const startOfToday = startOfDay(now)
×
30

31
  const startOfYesterday = new Date(startOfToday)
×
32
  startOfYesterday.setDate(startOfYesterday.getDate() - 1)
×
33

34
  const startOf7DaysAgo = new Date(startOfToday)
×
35
  startOf7DaysAgo.setDate(startOf7DaysAgo.getDate() - 7)
×
36

37
  const startOf30DaysAgo = new Date(startOfToday)
×
38
  startOf30DaysAgo.setDate(startOf30DaysAgo.getDate() - 30)
×
39

40
  return [
×
41
    {
42
      period: 'Aujourd’hui',
43
      threads: chatThreadHistory.filter(filterByDateRange(startOfToday)),
44
    },
45
    {
46
      period: 'Hier',
47
      threads: chatThreadHistory.filter(
48
        filterByDateRange(startOfYesterday, startOfToday),
49
      ),
50
    },
51
    {
52
      period: '7 derniers jours',
53
      threads: chatThreadHistory.filter(
54
        filterByDateRange(startOf7DaysAgo, startOfYesterday),
55
      ),
56
    },
57
    {
58
      period: '30 derniers jours',
59
      threads: chatThreadHistory.filter(
60
        filterByDateRange(startOf30DaysAgo, startOf7DaysAgo),
61
      ),
62
    },
63
    {
64
      period: 'Précédents',
65
      threads: chatThreadHistory.filter(
66
        filterByDateRange(new Date(0), startOf30DaysAgo),
67
      ),
68
    },
69
  ].filter(({ threads }) => threads.length > 0)
×
70
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc