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

teableio / teable / 19029600099

03 Nov 2025 09:18AM UTC coverage: 74.778% (-0.1%) from 74.874%
19029600099

push

github

web-flow
Merge pull request #2071 from teableio/fix/formula-issue

fix/formula issue

10481 of 11291 branches covered (92.83%)

167 of 204 new or added lines in 9 files covered. (81.86%)

1213 existing lines in 31 files now uncovered.

51694 of 69130 relevant lines covered (74.78%)

4380.26 hits per line

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

11.86
/apps/nestjs-backend/src/db-provider/sort-query/sqlite/single-value/string-sort.adapter.ts
1
import type { ISelectFieldOptions } from '@teable/core';
2✔
2
import { FieldType } from '@teable/core';
3
import type { Knex } from 'knex';
4
import { SortFunctionSqlite } from '../sort-query.function';
5

6
export class StringSortAdapter extends SortFunctionSqlite {
2✔
7
  asc(builderClient: Knex.QueryBuilder): Knex.QueryBuilder {
2✔
8
    if (!this.columnName) {
×
UNCOV
9
      return builderClient;
×
10
    }
×
11
    const { type, options } = this.field;
×
12

UNCOV
13
    if (type !== FieldType.SingleSelect) {
×
14
      return super.asc(builderClient);
×
UNCOV
15
    }
×
16

17
    const { choices } = options as ISelectFieldOptions;
×
18

UNCOV
19
    const optionSets = choices.map(({ name }) => name);
×
20
    builderClient.orderByRaw(
×
21
      `${this.generateOrderByCase(optionSets, this.columnName)} ASC NULLS FIRST`
×
22
    );
UNCOV
23
    return builderClient;
×
24
  }
×
25

26
  desc(builderClient: Knex.QueryBuilder): Knex.QueryBuilder {
2✔
27
    if (!this.columnName) {
×
28
      return builderClient;
×
UNCOV
29
    }
×
30
    const { type, options } = this.field;
×
31

32
    if (type !== FieldType.SingleSelect) {
×
33
      return super.desc(builderClient);
×
34
    }
×
35

36
    const { choices } = options as ISelectFieldOptions;
×
37

UNCOV
38
    const optionSets = choices.map(({ name }) => name);
×
UNCOV
39
    builderClient.orderByRaw(
×
40
      `${this.generateOrderByCase(optionSets, this.columnName)} DESC NULLS LAST`
×
41
    );
42
    return builderClient;
×
43
  }
×
44

45
  getAscSQL() {
2✔
46
    const { type, options } = this.field;
×
47

48
    if (type !== FieldType.SingleSelect) {
×
49
      return super.getAscSQL();
×
50
    }
×
51
    if (!this.columnName) {
×
52
      return undefined;
×
UNCOV
53
    }
×
54

55
    const { choices } = options as ISelectFieldOptions;
×
56

57
    const optionSets = choices.map(({ name }) => name);
×
58
    return this.knex
×
59
      .raw(`${this.generateOrderByCase(optionSets, this.columnName)} ASC NULLS FIRST`)
×
UNCOV
60
      .toQuery();
×
61
  }
×
62

63
  getDescSQL() {
2✔
64
    const { type, options } = this.field;
×
65

66
    if (type !== FieldType.SingleSelect) {
×
67
      return super.getDescSQL();
×
UNCOV
68
    }
×
UNCOV
69
    if (!this.columnName) {
×
UNCOV
70
      return undefined;
×
UNCOV
71
    }
×
72

UNCOV
73
    const { choices } = options as ISelectFieldOptions;
×
74

UNCOV
75
    const optionSets = choices.map(({ name }) => name);
×
UNCOV
76
    return this.knex
×
UNCOV
77
      .raw(`${this.generateOrderByCase(optionSets, this.columnName)} DESC NULLS LAST`)
×
UNCOV
78
      .toQuery();
×
UNCOV
79
  }
×
80
}
2✔
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