Skip to content

Commit

Permalink
Update to include security fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
shawnwildermuth committed Oct 29, 2021
1 parent 2927802 commit f45708f
Show file tree
Hide file tree
Showing 4 changed files with 23,706 additions and 14,583 deletions.
45 changes: 25 additions & 20 deletions src/CoreCodeCamp/Controllers/Web/RootController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,38 +120,43 @@ public async Task<IActionResult> Sessions(string moniker)
[HttpGet("{moniker}/Schedule")]
public async Task<IActionResult> Schedule(string moniker)
{
var favorites = await _repo.GetUserWithFavoriteTalksForEventAsync(User.Identity.Name, moniker);

var slots = await _repo.GetTalksInSlotsAsync(moniker);
if (string.IsNullOrWhiteSpace(this._theEvent.SessionizeId))
{
var favorites = await _repo.GetUserWithFavoriteTalksForEventAsync(User.Identity.Name, moniker);

var categories = slots.SelectMany(s => s.ToList())
.SelectMany(s => s.Talks)
.Select(t => t.Category)
.OrderBy(t => t)
.Distinct()
.ToList();
var slots = await _repo.GetTalksInSlotsAsync(moniker);

DateTime pickedSlot = DateTime.MinValue;
var categories = slots.SelectMany(s => s.ToList())
.SelectMany(s => s.Talks)
.Select(t => t.Category)
.OrderBy(t => t)
.Distinct()
.ToList();

if (slots.Count() > 0)
{
var easternZone = TZConvert.GetTimeZoneInfo("Eastern Standard Time");
var eventTime = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, easternZone);
DateTime pickedSlot = DateTime.MinValue;

if (eventTime.Date == this._theEvent.EventDate)
if (slots.Count() > 0)
{
pickedSlot = slots[0].First().Time;
var easternZone = TZConvert.GetTimeZoneInfo("Eastern Standard Time");
var eventTime = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, easternZone);

foreach (var slot in slots)
if (eventTime.Date == this._theEvent.EventDate)
{
if (slot.First().Time > eventTime)
pickedSlot = slots[0].First().Time;

foreach (var slot in slots)
{
pickedSlot = slot.First().Time;
if (slot.First().Time > eventTime)
{
pickedSlot = slot.First().Time;
}
}
}
}
return View(Tuple.Create(slots, favorites, pickedSlot, categories));
}
return View(Tuple.Create(slots, favorites, pickedSlot, categories));

return View();
}

[HttpGet("{moniker}/Register")]
Expand Down
38 changes: 19 additions & 19 deletions src/CoreCodeCamp/Views/Root/Schedule.cshtml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
@model Tuple<List<IEnumerable<ScheduleModel>>, IEnumerable<Talk>, DateTime, List<string>>
@inject UserManager<CodeCampUser> userMgr
@inject SignInManager<CodeCampUser> signInMgr
@{
var codeCampUser = await userMgr.GetUserAsync(User);
ViewData["Title"] = "Schedule";
@*@model Tuple<List<IEnumerable<ScheduleModel>>, IEnumerable<Talk>, DateTime, List<string>>
@inject UserManager<CodeCampUser> userMgr
@inject SignInManager<CodeCampUser> signInMgr
@{
var codeCampUser = await userMgr.GetUserAsync(User);
ViewData["Title"] = "Schedule";
var slots = Model.Item1;
var favs = Model.Item2;
var pickedTime = Model.Item3;
var slots = Model.Item1;
var favs = Model.Item2;
var pickedTime = Model.Item3;
var isAdmin = (codeCampUser != null && signInMgr.IsSignedIn(User) && await userMgr.IsInRoleAsync(codeCampUser, Consts.ADMINROLE));
}
@section Scripts {
<script>
(function ($) {
var timeBlock = $('.current-time');
if (timeBlock.length > 0) window.scrollTo(0, timeBlock.offset().top - 50);
})(jQuery);
</script>
}
var isAdmin = (codeCampUser != null && signInMgr.IsSignedIn(User) && await userMgr.IsInRoleAsync(codeCampUser, Consts.ADMINROLE));
}
@section Scripts {
<script>
(function ($) {
var timeBlock = $('.current-time');
if (timeBlock.length > 0) window.scrollTo(0, timeBlock.offset().top - 50);
})(jQuery);
</script>
}*@
<div class="row">
<script type="text/javascript" src="https://sessionize.com/api/v2/@(this.GetEventInfo().SessionizeEmbedId)/view/GridSmart"></script>
</div>
Loading

0 comments on commit f45708f

Please sign in to comment.