Set updatedAt in the past in demo schedule
Make sure that all of the entities generated in the demo schedule are updated in the past. Otherwise updates for them will end up rejected for being before the current entity's updateAt property. This also sets the origin for the schedule to be yesterday to make it easiser to demo the schedule between friday and tuesday.
This commit is contained in:
parent
f24dbae5eb
commit
60f898e986
1 changed files with 11 additions and 11 deletions
|
@ -6,31 +6,31 @@ const locations = [
|
|||
id: 1,
|
||||
name: "Stage",
|
||||
description: "Inside the main building.",
|
||||
updatedAt: "d0 18:21",
|
||||
updatedAt: "d-1 18:21",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "Clubhouse",
|
||||
description: "That big red building in the middle of the park.",
|
||||
updatedAt: "d0 18:25",
|
||||
updatedAt: "d-1 18:25",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Summerhouse",
|
||||
description: "Next to the campfire by the lake",
|
||||
updatedAt: "d0 18:22",
|
||||
updatedAt: "d-1 18:22",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Campfire",
|
||||
description: "Next to the big tree by the lake.",
|
||||
updatedAt: "d0 18:41",
|
||||
updatedAt: "d-1 18:41",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Outside",
|
||||
description: "Takes place somewhere outside.",
|
||||
updatedAt: "d0 18:37",
|
||||
updatedAt: "d-1 18:37",
|
||||
}
|
||||
]
|
||||
|
||||
|
@ -154,8 +154,8 @@ const events = [
|
|||
const idMedic = 1;
|
||||
const idSecurity = 2;
|
||||
const roles = [
|
||||
{ id: idMedic, name: "Medic", updatedAt: "d1 12:34" },
|
||||
{ id: idSecurity, name: "Security", updatedAt: "d1 12:39" },
|
||||
{ id: idMedic, name: "Medic", updatedAt: "d-2 12:34" },
|
||||
{ id: idSecurity, name: "Security", updatedAt: "d-2 12:39" },
|
||||
]
|
||||
|
||||
const shifts = [
|
||||
|
@ -263,7 +263,7 @@ function toShift(origin: Date, shorthand: string, idToAssigned: Map<number, numb
|
|||
function getDemoOrigin() {
|
||||
const origin = new Date();
|
||||
const utcOffset = 1;
|
||||
origin.setUTCDate(origin.getUTCDate() - origin.getUTCDay() + 1); // Go to Monday
|
||||
origin.setUTCDate(origin.getUTCDate() - 1); // Day 0 is yesterday
|
||||
origin.setUTCHours(-utcOffset);
|
||||
origin.setUTCMinutes(0);
|
||||
origin.setUTCSeconds(0);
|
||||
|
@ -332,7 +332,7 @@ export function generateDemoSchedule(): ApiSchedule {
|
|||
|
||||
return {
|
||||
id: 111,
|
||||
updatedAt: toIso(toDate(origin, "d2", "10:01")),
|
||||
updatedAt: toIso(toDate(origin, "d-2", "10:01")),
|
||||
events: events.map(
|
||||
({ id, name, crew, description, slots }) => ({
|
||||
id,
|
||||
|
@ -341,7 +341,7 @@ export function generateDemoSchedule(): ApiSchedule {
|
|||
description,
|
||||
interested: eventCounts.get(id),
|
||||
slots: slots.map(shorthand => toSlot(origin, shorthand, slotCounts, eventSlotIdToAssigned)),
|
||||
updatedAt: toIso(toDate(origin, "d0", "15:11")),
|
||||
updatedAt: toIso(toDate(origin, "d-1", "15:11")),
|
||||
})
|
||||
),
|
||||
locations: locations.map(
|
||||
|
@ -365,7 +365,7 @@ export function generateDemoSchedule(): ApiSchedule {
|
|||
name,
|
||||
roleId,
|
||||
slots: slots.map(shorthand => toShift(origin, shorthand, shiftSlotIdToAssigned)),
|
||||
updatedAt: toIso(toDate(origin, "d0", "13:23")),
|
||||
updatedAt: toIso(toDate(origin, "d-1", "13:23")),
|
||||
})
|
||||
)
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue