module item sorting fixed

This commit is contained in:
2024-01-12 17:02:13 -07:00
parent 324bb94eda
commit b28bea77e9
8 changed files with 31 additions and 15 deletions

View File

@@ -24,8 +24,8 @@ public class CanvasAssignmentService(
assignments =>
assignments.Select(
a => a with { DueAt = a.DueAt?.ToLocalTime(), LockAt = a.LockAt?.ToLocalTime() }
)
);
).ToArray()
).ToArray();
}
public async Task<ulong> Create(

View File

@@ -62,7 +62,16 @@ public class CanvasModuleService
var (items, response) = await webRequestor.GetAsync<IEnumerable<CanvasModuleItem>>(request);
if (items == null)
throw new Exception($"Error getting canvas module items for {url}");
return items;
return items.Select(i =>
i with {
ContentDetails = i.ContentDetails == null
? null
: i.ContentDetails with {
DueAt = i.ContentDetails.DueAt?.ToLocalTime(),
LockAt = i.ContentDetails.LockAt?.ToLocalTime(),
}
}
);
}
public async Task<Dictionary<CanvasModule, IEnumerable<CanvasModuleItem>>> GetAllModulesItems(
@@ -90,4 +99,4 @@ public class CanvasModuleService
}
return output;
}
}
}

View File

@@ -18,7 +18,7 @@ public class CanvasService(
CanvasQuizService Quizzes,
CanvasCoursePageService Pages,
MyLogger<CanvasService> logger
)
)
{
private readonly IWebRequestor webRequestor = webRequestor;
private readonly CanvasServiceUtils utils = utils;