This commit is contained in:
Mr. Stallion 2023-07-07 17:23:58 -07:00
parent 21e33c6f62
commit ce2f83e8ef
2 changed files with 23 additions and 12 deletions

View File

@ -99,9 +99,9 @@ import MessageView from '../message_view';
interface CustomKinkWithScore extends CustomKink {
score: number;
name: string;
}
@Component({
components: {
'match-tags': MatchTags,
@ -308,15 +308,19 @@ export default class CharacterPreview extends Vue {
updateCustoms(): void {
this.customs = _.orderBy(
_.map(
_.reject(Object.values(this.character!.character.customs ?? []), (c) => _.isUndefined(c)) as CustomKink[],
(c: CustomKink) => _.assign(
{},
c,
{
score: kinkMapping[c.choice],
name: c.name.trim().replace(/^\W+/, '').replace(/\W+$/, '')
}
)
_.reject(Object.values(this.character!.character.customs ?? {}), (c) => _.isUndefined(c)) as CustomKink[],
(c: CustomKink) => {
const val: CustomKinkWithScore = _.assign(
{},
c,
{
score: kinkMapping[c.choice] as number,
name: c.name.trim().replace(/^\W+/, '').replace(/\W+$/, '')
}
) as CustomKinkWithScore;
return val;
}
),
['score', 'name'],
['desc', 'asc']

View File

@ -28,9 +28,9 @@ export class IndexedStore implements PermanentIndexedStore {
}
static async open(dbName: string = 'flist-ascending-profiles'): Promise<IndexedStore> {
const request = indexedDB.open(dbName, 2);
const request = indexedDB.open(dbName, 3);
request.onupgradeneeded = (event) => {
request.onupgradeneeded = async(event) => {
const db = request.result;
if (event.oldVersion < 1) {
@ -49,6 +49,13 @@ export class IndexedStore implements PermanentIndexedStore {
}
);
}
if (event.oldVersion < 3) {
const store = request.transaction!.objectStore(IndexedStore.STORE_NAME);
const req = store.clear();
await promisifyRequest(req);
}
};
return new IndexedStore(await promisifyRequest<IDBDatabase>(request), dbName);