Added latest compute date to creatures
This commit is contained in:
@@ -158,6 +158,10 @@ const CreatureSchema = TypedSimpleSchema.from({
|
|||||||
blackbox: true,
|
blackbox: true,
|
||||||
optional: true,
|
optional: true,
|
||||||
},
|
},
|
||||||
|
lastComputedAt: {
|
||||||
|
type: Date,
|
||||||
|
optional: true,
|
||||||
|
},
|
||||||
|
|
||||||
// Tabletop
|
// Tabletop
|
||||||
tabletopId: {
|
tabletopId: {
|
||||||
|
|||||||
@@ -2,8 +2,19 @@ import Creatures from '/imports/api/creature/creatures/Creatures';
|
|||||||
|
|
||||||
export default function writeErrorsAndPropCount(creatureId, errors = [], propCount) {
|
export default function writeErrorsAndPropCount(creatureId, errors = [], propCount) {
|
||||||
if (errors.length) {
|
if (errors.length) {
|
||||||
Creatures.update(creatureId, { $set: { computeErrors: errors, propCount } });
|
Creatures.update(creatureId, {
|
||||||
|
$set: {
|
||||||
|
computeErrors: errors,
|
||||||
|
propCount,
|
||||||
|
lastComputedAt: new Date(),
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
Creatures.update(creatureId, { $set: { propCount }, $unset: { computeErrors: 1 } });
|
Creatures.update(creatureId, {
|
||||||
|
$set: {
|
||||||
|
propCount,
|
||||||
|
lastComputedAt: new Date(),
|
||||||
|
}, $unset: { computeErrors: 1 }
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user