wip fixes

This commit is contained in:
Tau
2019-04-29 13:25:21 -04:00
parent 595f2db28f
commit 1a5290a461
5 changed files with 21 additions and 9 deletions

View File

@@ -120,7 +120,8 @@ create table "idz"."story_cell_state" (
"row_no" integer not null,
"col_no" integer not null,
"a" smallint not null,
"b" smallint not null
"b" smallint not null,
constraint story_cell_state_uq unique ("profile_id", "row_no", "col_no")
);
create table "idz"."free_car" (

View File

@@ -61,6 +61,8 @@ export class SqlCharaRepository implements FacetRepository<Chara> {
"field_0A",
"field_0C",
"field_0E",
"title",
"background",
])
.toParams();

View File

@@ -50,7 +50,7 @@ export class SqlStoryRepository implements FacetRepository<Story> {
const { rows } = await this._conn.query(loadCellSql);
for (const row of rows) {
const cell = result.rows[row.row_no].cells[row.cell_no];
const cell = result.rows[row.row_no].cells[row.col_no];
cell.a = row.a;
cell.b = row.b;
@@ -102,7 +102,8 @@ export class SqlStoryRepository implements FacetRepository<Story> {
b: cell.b,
})
.onConflict("profile_id", "row_no", "col_no")
.doUpdate("a", "b");
.doUpdate(["a", "b"])
.toParams();
await this._conn.query(cellSql);
}

View File

@@ -6,12 +6,17 @@ export async function saveTimeAttack(
w: Repositories,
req: SaveTimeAttackRequest
): Promise<SaveTimeAttackResponse> {
// Override client time since we might be doing some maintenance window
// avoidance time warping stuff
// Non time-attack credits still call this method, but they pass some
// bullshit payload that we need to ignore.
await w
.timeAttack()
.save(req.profileId, { ...req.payload, timestamp: new Date() });
if (req.payload.totalTime > 0) {
// Override client time since we might be doing some maintenance window
// avoidance time warping stuff
await w
.timeAttack()
.save(req.profileId, { ...req.payload, timestamp: new Date() });
}
return {
type: "save_time_attack_res",

View File

@@ -1,4 +1,5 @@
import express = require("express");
import iconv = require("iconv-lite");
import read = require("raw-body");
import { unzipSync } from "zlib";
@@ -57,7 +58,9 @@ app.use(async function(req, res, next) {
res.set("content-type", "text/plain");
return send_.apply(res, [str]);
const bin = iconv.encode(str, "shift_jis");
return send_.apply(res, [bin]);
};
return next();