Skip to content

Commit 0408846

Browse files
committed
Add seed data for 2025 and pull breaks from sessionize
1 parent b313ece commit 0408846

3 files changed

Lines changed: 48 additions & 10 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
-- Before running this script, ensure that FullDBScript.sql has been run to create the tables
2+
3+
-- Remove all the data
4+
delete [UserSessionFeedback]
5+
delete [UserEventFeedback]
6+
delete [Sessions]
7+
delete TimeSlots
8+
delete Tracks
9+
delete EventDetail
10+
11+
12+
GO
13+
14+
-- Reset the identity columns
15+
DBCC CHECKIDENT ('[Tracks]', RESEED, 0);
16+
DBCC CHECKIDENT ('[TimeSlots]', RESEED, 0);
17+
DBCC CHECKIDENT ('[Sessions]', RESEED, 0);
18+
19+
-- There is hardcoding to EventDetail ID 1 so we reset to 1 not 0
20+
DBCC CHECKIDENT ('[EventDetail]', RESEED, 1); -- Use if this is a brand new table that has never been used before
21+
--DBCC CHECKIDENT ('[EventDetail]', RESEED, 0); -- Use if this is an empty table that used to have rows
22+
23+
GO
24+
25+
-- Add 2025 Sessionize ID
26+
Insert into EventDetail
27+
values (1, '8oswqcwt')
28+
29+
GO

PocketDDD.Server/PocketDDD.Server.Model/Sessionize/ApiDTOs.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public class SessionizeEvent
5555

5656
public class Session
5757
{
58-
public int id { get; set; }
58+
public string id { get; set; }
5959
public string title { get; set; }
6060
public string description { get; set; }
6161
public DateTime startsAt { get; set; }

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

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Net.Http.Json;
66

77
namespace PocketDDD.Server.Services;
8+
89
public class SessionizeService
910
{
1011
private readonly HttpClient httpClient;
@@ -50,7 +51,8 @@ public async Task UpdateFromSessionize()
5051

5152
var dbTimeSlots = await dbContext.TimeSlots.ToListAsync();
5253
var sessionizeTimeSlots = sessionizeEvent.sessions
53-
.Select(x => (x.startsAt, x.endsAt))
54+
.Select(x => (x.startsAt, x.endsAt, x.isServiceSession,
55+
serviceSessionDetails: x.isServiceSession ? x.title : null))
5456
.Distinct()
5557
.ToList();
5658

@@ -64,7 +66,7 @@ public async Task UpdateFromSessionize()
6466
EventDetail = dbEvent,
6567
From = item.startsAt,
6668
To = item.endsAt,
67-
Info = null
69+
Info = item.isServiceSession ? item.serviceSessionDetails : null
6870
};
6971
dbContext.TimeSlots.Add(dbTimeSlot);
7072
}
@@ -80,12 +82,16 @@ public async Task UpdateFromSessionize()
8082

8183
foreach (var item in sessionizeEvent.sessions)
8284
{
83-
var dbSession = dbSessions.SingleOrDefault(x => x.SessionizeId == item.id);
85+
if (item.isServiceSession) continue;
86+
87+
var sessionizeId = int.Parse(item.id);
88+
89+
var dbSession = dbSessions.SingleOrDefault(x => x.SessionizeId == sessionizeId);
8490
if (dbSession == null)
8591
{
8692
dbSession = new Model.DBModel.Session
8793
{
88-
SessionizeId = item.id,
94+
SessionizeId = sessionizeId,
8995
EventDetail = dbEvent,
9096
SpeakerToken = Guid.NewGuid(),
9197
ShortDescription = ""
@@ -103,10 +109,13 @@ public async Task UpdateFromSessionize()
103109
await dbContext.SaveChangesAsync();
104110
}
105111

106-
private string GetSpeakers(List<PocketDDD.Server.Model.Sessionize.Speaker> speakers, List<string> speakerIds)
107-
=> speakerIds.Aggregate("", (acc, x) => acc + ", " + speakers.Single(s => s.id == x).fullName).Trim(',');
112+
private string GetSpeakers(List<Speaker> speakers, List<string> speakerIds)
113+
{
114+
return speakerIds.Aggregate("", (acc, x) => acc + ", " + speakers.Single(s => s.id == x).fullName).Trim(',');
115+
}
108116

109117
private TimeSlot GetTimeSlot(List<TimeSlot> timeSlots, DateTime startsAt, DateTime endsAt)
110-
=> timeSlots.Single(x => x.From == startsAt && x.To == endsAt);
111-
112-
}
118+
{
119+
return timeSlots.Single(x => x.From == startsAt && x.To == endsAt);
120+
}
121+
}

0 commit comments

Comments
 (0)