Skip to content

Commit

Permalink
fix code from review
Browse files Browse the repository at this point in the history
  • Loading branch information
mla04762 committed Jul 21, 2023
1 parent 1366e8b commit 1c5a783
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
20 changes: 12 additions & 8 deletions Gordon360/Models/ViewModels/UserCoursesViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Microsoft.AspNetCore.Http.Features;
using Microsoft.Graph;
using System;
using System.Linq;
using System.Runtime.Serialization.Formatters;

namespace Gordon360.Models.ViewModels
Expand All @@ -26,15 +27,18 @@ public class UserCoursesViewModel
public static implicit operator UserCoursesViewModel(UserCourses course)
{
var code = course.YR_CDE;
if(course.TRM_CDE == "FA")
{
code += "09";
} else if (course.TRM_CDE == "SP")
{
code += "01";
} else

switch (course.TRM_CDE)
{
code += "05";
case "FA":
code += "09";
break;
case "SP":
code = (Int32.Parse(code) + 1).ToString() + "01";
break;
default:
code = (Int32.Parse(code) + 1).ToString() + "05";
break;
}

UserCoursesViewModel vm = new UserCoursesViewModel
Expand Down
3 changes: 1 addition & 2 deletions Gordon360/Services/ScheduleService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using static Microsoft.EntityFrameworkCore.DbLoggerCategory;

namespace Gordon360.Services
{
Expand Down Expand Up @@ -113,7 +112,7 @@ public async Task<IEnumerable<SessionCoursesViewModel>> GetAllCourses(string use
var allSchedule = _context.UserCourses
.Where(s => s.UserID == account.gordon_id)
.Select(s => (UserCoursesViewModel)s)
.ToList()
.AsEnumerable()
.OrderByDescending(course => course.SessionCode);

foreach (SessionViewModel vm in allSessions)
Expand Down

0 comments on commit 1c5a783

Please sign in to comment.