Ensure creature properties are sorted before being migrated from an archive
This commit is contained in:
@@ -1,12 +1,14 @@
|
|||||||
import migrateProperty2To3 from '/imports/migrations/archive/properties/migrateProperty2To3';
|
import migrateProperty2To3 from '/imports/migrations/archive/properties/migrateProperty2To3';
|
||||||
|
|
||||||
export default function migrateApiCreature2To3(creature) {
|
export default function migrateApiCreature2To3(creature) {
|
||||||
creature.creatureProperties = creature.creatureProperties.map(prop => {
|
creature.creatureProperties = creature.creatureProperties
|
||||||
try {
|
.sort((a, b) => a.order - b.order)
|
||||||
migrateProperty2To3(prop);
|
.map(prop => {
|
||||||
} catch (e) {
|
try {
|
||||||
console.warn('Property migration 2 -> 3 failed: ', { propId: prop._id, error: e.message || e.reason || e.toString() });
|
migrateProperty2To3(prop);
|
||||||
}
|
} catch (e) {
|
||||||
return prop;
|
console.warn('Property migration 2 -> 3 failed: ', { propId: prop._id, error: e.message || e.reason || e.toString() });
|
||||||
});
|
}
|
||||||
|
return prop;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user