mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-25 15:18:32 -06:00
finally had to deal with too many http requests
This commit is contained in:
@@ -1,15 +1,31 @@
|
||||
"use client";
|
||||
import { CalendarMonthModel } from "./calendarMonthUtils";
|
||||
import { CalendarMonthModel, getWeekNumber } from "./calendarMonthUtils";
|
||||
import { DayOfWeek } from "@/models/local/localCourseSettings";
|
||||
import { Expandable } from "@/components/Expandable";
|
||||
import { CalendarWeek } from "./CalendarWeek";
|
||||
import { useLocalCourseSettingsQuery } from "@/hooks/localCourse/localCoursesHooks";
|
||||
import { getDateFromStringOrThrow } from "@/models/local/utils/timeUtils";
|
||||
|
||||
export const CalendarMonth = ({ month }: { month: CalendarMonthModel }) => {
|
||||
// const weekInMilliseconds = 604_800_000;
|
||||
const four_days_in_milliseconds = 345_600_000;
|
||||
const isInPast =
|
||||
new Date(month.year, month.month, 1) <
|
||||
new Date(Date.now() - four_days_in_milliseconds);
|
||||
const [settings] = useLocalCourseSettingsQuery();
|
||||
const startDate = getDateFromStringOrThrow(
|
||||
settings.startDate,
|
||||
"week calculation start date"
|
||||
);
|
||||
|
||||
const pastWeekNumber = getWeekNumber(
|
||||
startDate,
|
||||
new Date(Date.now() - four_days_in_milliseconds)
|
||||
);
|
||||
|
||||
const startOfMonthWeekNumber = getWeekNumber(
|
||||
startDate,
|
||||
new Date(month.year, month.month, 1)
|
||||
);
|
||||
|
||||
const isInPast = pastWeekNumber >= startOfMonthWeekNumber;
|
||||
|
||||
const monthName = new Date(month.year, month.month - 1, 1).toLocaleString(
|
||||
"default",
|
||||
|
||||
@@ -19,6 +19,7 @@ export default function TrpcProvider({
|
||||
httpBatchLink({
|
||||
url,
|
||||
transformer: superjson,
|
||||
maxURLLength: 10_000, // limit number of batched requests
|
||||
}),
|
||||
],
|
||||
})
|
||||
|
||||
@@ -14,11 +14,13 @@ export const assignmentRouter = router({
|
||||
})
|
||||
)
|
||||
.query(async ({ input: { courseName, moduleName, assignmentName } }) => {
|
||||
return await fileStorageService.assignments.getAssignment(
|
||||
const assignment = await fileStorageService.assignments.getAssignment(
|
||||
courseName,
|
||||
moduleName,
|
||||
assignmentName
|
||||
);
|
||||
// console.log(assignment);
|
||||
return assignment;
|
||||
}),
|
||||
getAllAssignments: publicProcedure
|
||||
.input(
|
||||
@@ -28,10 +30,11 @@ export const assignmentRouter = router({
|
||||
})
|
||||
)
|
||||
.query(async ({ input: { courseName, moduleName } }) => {
|
||||
return await fileStorageService.assignments.getAssignments(
|
||||
const assignments = await fileStorageService.assignments.getAssignments(
|
||||
courseName,
|
||||
moduleName
|
||||
);
|
||||
return assignments;
|
||||
}),
|
||||
createAssignment: publicProcedure
|
||||
.input(
|
||||
|
||||
Reference in New Issue
Block a user