Commit 7f3dd2ed authored by nanahira's avatar nanahira

fix mutate

parent 76c5bbb6
Pipeline #29362 passed with stages
in 1 minute and 12 seconds
...@@ -85,7 +85,7 @@ export class Card { ...@@ -85,7 +85,7 @@ export class Card {
} }
return (cardType & (0x4000000 | 0x800000 | 0x2000 | 0x40)) > 0; return (cardType & (0x4000000 | 0x800000 | 0x2000 | 0x40)) > 0;
} }
async loadData(db: Database, symbol: string) { async loadData(db: Database) {
this.preDatas = this.datas; this.preDatas = this.datas;
this.preTexts = this.texts; this.preTexts = this.texts;
this.loadedDatas = await db.get("select * from datas where id = ?", [this.code]); this.loadedDatas = await db.get("select * from datas where id = ?", [this.code]);
...@@ -98,8 +98,6 @@ export class Card { ...@@ -98,8 +98,6 @@ export class Card {
...this.loadedTexts, ...this.loadedTexts,
...this.preTexts ...this.preTexts
} }
this.datas.ot |= 0x8;
this.texts.desc += '\r\n\r\n\u2605' + symbol;
} }
getSQLQueries() { getSQLQueries() {
const datasArray = this.getDatasArray(); const datasArray = this.getDatasArray();
...@@ -228,9 +226,15 @@ export class DBReader extends Base { ...@@ -228,9 +226,15 @@ export class DBReader extends Base {
async run(cards: Card[], options: { async run(cards: Card[], options: {
extraBanlists?: Banlist[] extraBanlists?: Banlist[]
} = {}) { } = {}) {
await Promise.all(cards.map(card => card.loadData(this.cndb, this.config.descSymbol))); await Promise.all(cards.map(card => card.loadData(this.cndb)));
const extendedCards = (await Promise.all(cards.map(card => card.getRelatedCards(this.cndb)))).flat(); const extendedCards = (await Promise.all(cards.map(card => card.getRelatedCards(this.cndb)))).flat();
const allCards = _.uniqBy(cards.concat(extendedCards), (s) => s.code); const allCards = _.uniqBy(cards.concat(extendedCards), (s) => s.code);
allCards.forEach((card) => {
if (this.config.fileSymbol === 'cn') {
card.datas.ot |= 0x8;
}
card.texts.desc += '\r\n\r\n\u2605' + this.config.descSymbol;
})
const queries = allCards.flatMap(card => card.getSQLQueries()); const queries = allCards.flatMap(card => card.getSQLQueries());
await this.openOutputDatabase(); await this.openOutputDatabase();
await this.outputdb.run("BEGIN TRANSACTION;"); await this.outputdb.run("BEGIN TRANSACTION;");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment