mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-26 15:48:32 -06:00
more refactor
This commit is contained in:
@@ -4,7 +4,7 @@ import { CalendarItemsInterface } from "@/app/course/[courseName]/context/calend
|
||||
import {
|
||||
getDateOnlyMarkdownString,
|
||||
getDateFromStringOrThrow,
|
||||
} from "@/models/local/utils/timeUtils";
|
||||
} from "@/features/local/utils/timeUtils";
|
||||
import {
|
||||
useSuspenseQuery,
|
||||
useMutation,
|
||||
@@ -92,10 +92,7 @@ export const useCoursePagesByModuleByDateQuery = () => {
|
||||
}
|
||||
);
|
||||
const pagesByModuleByDate = pagesAndModules.reduce(
|
||||
(
|
||||
previous,
|
||||
{ page, moduleName }
|
||||
) => {
|
||||
(previous, { page, moduleName }) => {
|
||||
const dueDay = getDateOnlyMarkdownString(
|
||||
getDateFromStringOrThrow(page.dueAt, "due at for page in items context")
|
||||
);
|
||||
@@ -129,9 +126,7 @@ export const useCourseAssignmentsByModuleByDateQuery = () => {
|
||||
trpc.assignment.getAllAssignments.queryOptions({ courseName, moduleName })
|
||||
),
|
||||
});
|
||||
const assignments = assignmentsResults.map(
|
||||
(result) => result.data
|
||||
);
|
||||
const assignments = assignmentsResults.map((result) => result.data);
|
||||
const assignmentsAndModules = moduleNames.flatMap(
|
||||
(moduleName: string, index: number) => {
|
||||
return assignments[index].map((assignment) => ({
|
||||
@@ -141,10 +136,7 @@ export const useCourseAssignmentsByModuleByDateQuery = () => {
|
||||
}
|
||||
);
|
||||
const assignmentsByModuleByDate = assignmentsAndModules.reduce(
|
||||
(
|
||||
previous,
|
||||
{ assignment, moduleName }
|
||||
) => {
|
||||
(previous, { assignment, moduleName }) => {
|
||||
const dueDay = getDateOnlyMarkdownString(
|
||||
getDateFromStringOrThrow(
|
||||
assignment.dueAt,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { LocalCoursePage } from "@/features/local/pages/localCoursePageModels";
|
||||
import { LocalAssignment } from "../assignments/models/localAssignment";
|
||||
import { IModuleItem } from "./IModuleItem";
|
||||
import { getDateFromString } from "../../../models/local/utils/timeUtils";
|
||||
import { getDateFromString } from "../utils/timeUtils";
|
||||
import { LocalQuiz } from "@/features/local/quizzes/models/localQuiz";
|
||||
|
||||
export interface LocalModule {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { promises as fs } from "fs";
|
||||
import { lectureFolderName } from "../../../services/fileStorage/utils/lectureUtils";
|
||||
import { getCoursePathByName } from "../../../services/fileStorage/globalSettingsFileStorageService";
|
||||
import { getCoursePathByName } from "../globalSettings/globalSettingsFileStorageService";
|
||||
|
||||
export const moduleFileStorageService = {
|
||||
async getModuleNames(courseName: string) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { z } from "zod";
|
||||
import { fileStorageService } from "@/services/fileStorage/fileStorageService";
|
||||
import { fileStorageService } from "@/features/local/utils/fileStorageService";
|
||||
import { router } from "@/services/serverFunctions/trpcSetup";
|
||||
import publicProcedure from "@/services/serverFunctions/procedures/public";
|
||||
import publicProcedure from "@/services/serverFunctions/publicProcedure";
|
||||
|
||||
export const moduleRouter = router({
|
||||
getModuleNames: publicProcedure
|
||||
|
||||
Reference in New Issue
Block a user