Skip to content

Commit 51b4da2

Browse files
committed
Increase the event details version when update from sessionize changes things
This allows changes to filter to the client
1 parent 8f331be commit 51b4da2

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

PocketDDD.BlazorClient/PocketDDD.BlazorClient/Services/FakePocketDDDApiService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public void SetUserAuthToken(string token)
2626
new EventDataResponseDTO
2727
{
2828
Id = 1,
29-
Version = 1,
29+
Version = 0, //Set to 0 so if we ever connect this to a real API then it will update!
3030
TimeSlots = new[]
3131
{
3232
new TimeSlotDTO

PocketDDD.Server/PocketDDD.Server.Services/SessionizeService.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,15 @@ public async Task UpdateFromSessionize()
6060

6161
if (dbContext.ChangeTracker.HasChanges())
6262
{
63+
dbEvent.Version++;
6364
Logger.LogInformation("Updating db with changes to rooms");
6465
await dbContext.SaveChangesAsync();
6566
}
6667
else
6768
{
6869
Logger.LogInformation("No changes to rooms were detected");
6970
}
70-
71+
7172
Logger.LogInformation("Looking for changes to time slots and breaks");
7273

7374
var dbTimeSlots = await dbContext.TimeSlots.ToListAsync();
@@ -93,8 +94,10 @@ public async Task UpdateFromSessionize()
9394

9495
dbTimeSlot.Info = item.isServiceSession ? item.serviceSessionDetails : null;
9596
}
97+
9698
if (dbContext.ChangeTracker.HasChanges())
9799
{
100+
dbEvent.Version++;
98101
Logger.LogInformation("Updating db with changes to time slots and breaks");
99102
await dbContext.SaveChangesAsync();
100103
}
@@ -135,8 +138,10 @@ public async Task UpdateFromSessionize()
135138
dbSession.Track = dbTracks.Single(x => x.SessionizeId == item.roomId);
136139
dbSession.TimeSlot = GetTimeSlot(dbTimeSlots, item.startsAt, item.endsAt);
137140
}
141+
138142
if (dbContext.ChangeTracker.HasChanges())
139143
{
144+
dbEvent.Version++;
140145
Logger.LogInformation("Updating db with changes to sessions");
141146
await dbContext.SaveChangesAsync();
142147
}

0 commit comments

Comments
 (0)