|
| 1 | +// Without using runtypes, an orm or query-generator, we need to use any on |
| 2 | +// the db results and trust our SQL-skills. |
| 3 | +/* eslint-disable @typescript-eslint/no-unsafe-return */ |
| 4 | +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ |
| 5 | +/* eslint-disable @typescript-eslint/no-explicit-any */ |
| 6 | + |
1 | 7 | import { Database as SqliteDatabase } from "./sqlite";
|
2 | 8 | import { schema } from "./schema";
|
3 | 9 |
|
@@ -158,11 +164,13 @@ export class Database {
|
158 | 164 | await this._insertResults(data.results);
|
159 | 165 | }
|
160 | 166 |
|
161 |
| - async findBenchmarks(): Promise<{ |
162 |
| - id: number; |
163 |
| - name: string; |
164 |
| - selected: 0 | 1; |
165 |
| - }> { |
| 167 | + async findBenchmarks(): Promise< |
| 168 | + { |
| 169 | + id: number; |
| 170 | + name: string; |
| 171 | + selected: 0 | 1; |
| 172 | + }[] |
| 173 | + > { |
166 | 174 | return (await this._db.query(
|
167 | 175 | "SELECT id, name, selected FROM benchmarks",
|
168 | 176 | )) as any;
|
@@ -198,25 +206,27 @@ export class Database {
|
198 | 206 | selected: boolean,
|
199 | 207 | ): Promise<void> {
|
200 | 208 | await this._db.query(
|
201 |
| - "UPDATE benchmarks SET selected = :selected WHERE id = :benchmarkId ORDER BY name ASC", |
| 209 | + "UPDATE benchmarks SET selected = :selected WHERE id = :benchmarkId", |
202 | 210 | {
|
203 | 211 | ":benchmarkId": benchmarkId,
|
204 | 212 | ":selected": selected ? 0 : 1,
|
205 | 213 | },
|
206 | 214 | );
|
| 215 | + this._notifyUpdateCallbacks(); |
207 | 216 | }
|
208 | 217 |
|
209 | 218 | async setRuntimeSelected(
|
210 | 219 | runtimeId: number,
|
211 | 220 | selected: boolean,
|
212 | 221 | ): Promise<void> {
|
213 | 222 | await this._db.query(
|
214 |
| - "UPDATE runtimes SET selected = :selected WHERE id = :runtimeId ORDER BY name ASC, version ASC", |
| 223 | + "UPDATE runtimes SET selected = :selected WHERE id = :runtimeId", |
215 | 224 | {
|
216 | 225 | ":runtimeId": runtimeId,
|
217 | 226 | ":selected": selected ? 0 : 1,
|
218 | 227 | },
|
219 | 228 | );
|
| 229 | + this._notifyUpdateCallbacks(); |
220 | 230 | }
|
221 | 231 |
|
222 | 232 | async findResults(): Promise<Result[]> {
|
|
0 commit comments