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

inclusion-numerique / coop-mediation-numerique / 82e0ecb8-5c73-49c1-a124-01e965ce67a7

06 Feb 2026 09:29AM UTC coverage: 7.371% (-3.1%) from 10.44%
82e0ecb8-5c73-49c1-a124-01e965ce67a7

push

circleci

hugues-m
feat: sync v1 users with dataspace

(cherry picked from commit f1ffd85bb)

469 of 9668 branches covered (4.85%)

Branch coverage included in aggregate %.

1330 of 14738 relevant lines covered (9.02%)

40.62 hits per line

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

0.0
/apps/web/src/libs/data-table/getDataTableOrderBy.ts
1
import {
2
  DataTableConfiguration,
3
  DataTableRow,
4
  DataTableSearchParams,
5
} from './DataTableConfiguration'
6

7
export const getDataTableOrderBy = <
×
8
  OrderBy extends Record<string, unknown> = Record<string, unknown>,
9
  Configuration extends DataTableConfiguration<
10
    DataTableRow,
11
    Record<string, unknown>,
12
    OrderBy
13
  > = DataTableConfiguration<DataTableRow, Record<string, unknown>, OrderBy>,
14
>(
15
  searchParams: DataTableSearchParams<Configuration>,
16
  configuration: Configuration,
17
): OrderBy[] => {
18
  const direction = searchParams.ordre ?? 'asc'
×
19

20
  // Applying default order by
21
  if (!searchParams.tri) {
×
22
    const defaultOrderByColumn = configuration.columns.find(
×
23
      (column) => column.defaultSortable && column.orderBy,
×
24
    )
25
    if (!defaultOrderByColumn || !defaultOrderByColumn.orderBy) {
×
26
      return []
×
27
    }
28

29
    return defaultOrderByColumn.orderBy(
×
30
      defaultOrderByColumn.defaultSortableDirection ?? direction,
×
31
    )
32
  }
33
  const column = configuration.columns.find(
×
34
    (item) => item.name === searchParams.tri,
×
35
  )
36

37
  return column?.orderBy ? column.orderBy(direction) : []
×
38
}
39

40
export const getDataTableRawOrderBy = <
×
41
  OrderBy extends Record<string, unknown> = Record<string, unknown>,
42
  Configuration extends DataTableConfiguration<
43
    DataTableRow,
44
    Record<string, unknown>,
45
    OrderBy
46
  > = DataTableConfiguration<DataTableRow, Record<string, unknown>, OrderBy>,
47
>(
48
  searchParams: DataTableSearchParams<Configuration>,
49
  configuration: Configuration,
50
): OrderBy[] => {
51
  const direction = searchParams.ordre ?? 'asc'
×
52

53
  // Applying default order by
54
  if (!searchParams.tri) {
×
55
    const defaultOrderByColumn = configuration.columns.find(
×
56
      (column) => column.defaultSortable && column.orderBy,
×
57
    )?.orderBy
58
    if (!defaultOrderByColumn) {
×
59
      return []
×
60
    }
61

62
    return defaultOrderByColumn(direction)
×
63
  }
64
  const column = configuration.columns.find(
×
65
    (item) => item.name === searchParams.tri,
×
66
  )
67

68
  return column?.orderBy ? column.orderBy(direction) : []
×
69
}
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