This commit is contained in:
redphx
2024-12-07 16:48:58 +07:00
parent 557a38214d
commit 4011eb402a
55 changed files with 181 additions and 139 deletions

View File

@@ -55,11 +55,11 @@ export class BaseLocalTable<T extends BaseRecord> {
return this.call(table.get.bind(table), ...arguments);
}
async getAll(): Promise<{[key: string]: T}> {
async getAll(): Promise<{ [key: string]: T }> {
const table = await this.prepareTable();
// @ts-ignore
const all = await (this.call(table.getAll.bind(table), ...arguments) as Promise<T[]>);
const results: {[key: string]: T} = {};
const results: { [key: string]: T } = {};
all.forEach(item => {
results[item.id as T['id']] = item;

View File

@@ -23,9 +23,13 @@ export class ControllerSettingsTable extends BaseLocalTable<ControllerSettingsRe
async getControllersData() {
const all = await this.getAll();
const results: {[key: string]: ControllerSettingsRecord['data']} = {};
const results: { [key: string]: ControllerSettingsRecord['data'] } = {};
for (const key in all) {
if (!all[key]) {
continue;
}
const settings = all[key].data;
// Pre-calculate virabtionIntensity
settings.vibrationIntensity /= 100;