update labeled
field for pet appearances
Oops, when building the Support tool to label pet appearances, I didn't realize that there's also a boolean `labeled` field that needs to be true for labeled appearances. Without it, the old app shows the appearance as "Unlabeled". I also ran this query to fix the rows we'd incorrectly written: ``` mysql> UPDATE pet_states SET labeled = 1 WHERE mood_id IS NOT NULL; Query OK, 158 rows affected (0.14 sec) Rows matched: 19640 Changed: 158 Warnings: 0 ```
This commit is contained in:
parent
f543868924
commit
68b5486bb7
2 changed files with 17 additions and 12 deletions
|
@ -380,12 +380,17 @@ const resolvers = {
|
||||||
|
|
||||||
const oldPetState = await petStateLoader.load(appearanceId);
|
const oldPetState = await petStateLoader.load(appearanceId);
|
||||||
|
|
||||||
const { moodId, female, unconverted } = getPetStateFieldsFromPose(pose);
|
const {
|
||||||
|
moodId,
|
||||||
|
female,
|
||||||
|
unconverted,
|
||||||
|
labeled,
|
||||||
|
} = getPetStateFieldsFromPose(pose);
|
||||||
|
|
||||||
const [result] = await db.execute(
|
const [result] = await db.execute(
|
||||||
`UPDATE pet_states SET mood_id = ?, female = ?, unconverted = ?
|
`UPDATE pet_states SET mood_id = ?, female = ?, unconverted = ?,
|
||||||
WHERE id = ? LIMIT 1`,
|
labeled = ? WHERE id = ? LIMIT 1`,
|
||||||
[moodId, female, unconverted, appearanceId]
|
[moodId, female, unconverted, labeled, appearanceId]
|
||||||
);
|
);
|
||||||
|
|
||||||
if (result.affectedRows !== 1) {
|
if (result.affectedRows !== 1) {
|
||||||
|
|
|
@ -36,21 +36,21 @@ function getPoseFromPetState(petState) {
|
||||||
|
|
||||||
function getPetStateFieldsFromPose(pose) {
|
function getPetStateFieldsFromPose(pose) {
|
||||||
if (pose === "UNCONVERTED") {
|
if (pose === "UNCONVERTED") {
|
||||||
return { moodId: null, female: null, unconverted: true };
|
return { moodId: null, female: null, unconverted: true, labeled: true };
|
||||||
} else if (pose === "UNKNOWN") {
|
} else if (pose === "UNKNOWN") {
|
||||||
return { moodId: null, female: null, unconverted: false };
|
return { moodId: null, female: null, unconverted: false, labeled: false };
|
||||||
} else if (pose === "HAPPY_MASC") {
|
} else if (pose === "HAPPY_MASC") {
|
||||||
return { moodId: "1", female: false, unconverted: false };
|
return { moodId: "1", female: false, unconverted: false, labeled: true };
|
||||||
} else if (pose === "HAPPY_FEM") {
|
} else if (pose === "HAPPY_FEM") {
|
||||||
return { moodId: "1", female: true, unconverted: false };
|
return { moodId: "1", female: true, unconverted: false, labeled: true };
|
||||||
} else if (pose === "SAD_MASC") {
|
} else if (pose === "SAD_MASC") {
|
||||||
return { moodId: "2", female: false, unconverted: false };
|
return { moodId: "2", female: false, unconverted: false, labeled: true };
|
||||||
} else if (pose === "SAD_FEM") {
|
} else if (pose === "SAD_FEM") {
|
||||||
return { moodId: "2", female: true, unconverted: false };
|
return { moodId: "2", female: true, unconverted: false, labeled: true };
|
||||||
} else if (pose === "SICK_MASC") {
|
} else if (pose === "SICK_MASC") {
|
||||||
return { moodId: "4", female: false, unconverted: false };
|
return { moodId: "4", female: false, unconverted: false, labeled: true };
|
||||||
} else if (pose === "SICK_FEM") {
|
} else if (pose === "SICK_FEM") {
|
||||||
return { moodId: "4", female: true, unconverted: false };
|
return { moodId: "4", female: true, unconverted: false, labeled: true };
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`unexpected pose ${pose}`);
|
throw new Error(`unexpected pose ${pose}`);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue