Skip to content

Commit

Permalink
. (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
ceciliasharp authored Sep 17, 2024
1 parent 5718aed commit d556229
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ConferenceService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public ConferenceService(SwetuggContext context, IMemoryCache cache)

public CurrentConferenceMeta? GetCurrentConferenceMeta() =>
ReadThroughCache("conference-current", () => _context.Conferences
.Where(c => c.End > DateTime.UtcNow)
.Where(c => c.HighlightDate <= DateTime.UtcNow.Date)
.OrderBy(c => c.End)
.Select(c => new CurrentConferenceMeta { Name = c.Name, Slug = c.Slug })
.FirstOrDefault()
Expand Down
4 changes: 3 additions & 1 deletion DbModels/Conference.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ public partial class Conference
public DateTime? Start { get; set; }

public DateTime? End { get; set; }


public DateTime? HighlightDate { get; set; }

public int MinNumberOfSpeakers { get; set; }

public virtual ICollection<ImageType> ImageTypes { get; } = new List<ImageType>();
Expand Down
1 change: 1 addition & 0 deletions DbModels/SwetuggContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
entity.Property(e => e.Name).HasMaxLength(250);
entity.Property(e => e.Slug).HasMaxLength(250);
entity.Property(e => e.Start).HasColumnType("datetime");
entity.Property(e => e.HighlightDate).HasColumnType("datetime");
});

modelBuilder.Entity<ImageType>(entity =>
Expand Down
2 changes: 1 addition & 1 deletion Pages/gbg-2023/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
if (conference == null)
throw new Exception("Conference not found in database");

var currentConferenceMeta = conference.End < DateTime.UtcNow ? conferenceService.GetCurrentConferenceMeta() : null;
var currentConferenceMeta = conferenceService.GetCurrentConferenceMeta();
}
<!DOCTYPE html>
<html lang="en">
Expand Down
2 changes: 1 addition & 1 deletion Pages/gbg-2024/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
if (conference == null)
throw new Exception("Conference not found in database");

var currentConferenceMeta = conference.End < DateTime.UtcNow ? conferenceService.GetCurrentConferenceMeta() : null;
var currentConferenceMeta = conferenceService.GetCurrentConferenceMeta();
}
<!DOCTYPE html>
<html lang="en">
Expand Down
2 changes: 1 addition & 1 deletion Pages/sthlm-2024/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
if (conference == null)
throw new Exception("Conference not found in database");

var currentConferenceMeta = conference.End < DateTime.UtcNow ? conferenceService.GetCurrentConferenceMeta() : null;
var currentConferenceMeta = conferenceService.GetCurrentConferenceMeta();
}
<!DOCTYPE html>
<html lang="en">
Expand Down

0 comments on commit d556229

Please sign in to comment.