fixing date formatting to month day year

This commit is contained in:
2024-08-27 19:59:26 -06:00
parent 4e412fd6bf
commit 27349af5b9
21 changed files with 284 additions and 212 deletions

View File

@@ -1,42 +0,0 @@
"use client";
import { getDateFromStringOrThrow } from "@/models/local/timeUtils";
import { useCourseContext } from "./context/courseContext";
import { getMonthsBetweenDates } from "./calendar/calendarMonthUtils";
import CalendarMonth from "./calendar/CalendarMonth";
export default function CourseDetails() {
const context = useCourseContext();
const startDate = getDateFromStringOrThrow(
context.localCourse.settings.startDate,
"course start date"
);
const endDate = getDateFromStringOrThrow(
context.localCourse.settings.endDate,
"course end date"
);
const months = getMonthsBetweenDates(startDate, endDate);
return (
<div>
{context.localCourse.settings.name}
<div className="flex flex-row">
<div className="grow">
{months.map((month) => (
<CalendarMonth
key={month.month + "" + month.year}
month={month}
localCourse={context.localCourse}
/>
))}
</div>
<div className="w-96">
<details>
<summary role="button">first module</summary>
<div>here are the module items</div>
</details>
</div>
</div>
</div>
);
}

View File

@@ -0,0 +1,8 @@
"use client";
import { useCourseContext } from "./context/courseContext";
export default function CourseSettings() {
const context = useCourseContext();
return <div>{context.localCourse.settings.name}</div>;
}

View File

@@ -1,4 +1,3 @@
"use client"
export default function ModuleList() {
return <div></div>
}

View File

@@ -4,13 +4,13 @@ import { CalendarMonthModel } from "./calendarMonthUtils";
import { DayOfWeek, LocalCourse } from "@/models/local/localCourse";
import Day from "./Day";
export default function CalendarMonth({
export const CalendarMonth = ({
month,
localCourse,
}: {
month: CalendarMonthModel;
localCourse: LocalCourse;
}) {
}) => {
const [isCollapsed, setIsCollapsed] = useState(false);
const isInPast =

View File

@@ -0,0 +1,32 @@
"use client";
import { getDateFromStringOrThrow } from "@/models/local/timeUtils";
import { useCourseContext } from "../context/courseContext";
import { getMonthsBetweenDates } from "./calendarMonthUtils";
import { CalendarMonth } from "./CalendarMonth";
export default function CourseCalendar() {
const context = useCourseContext();
const startDate = getDateFromStringOrThrow(
context.localCourse.settings.startDate,
"course start date"
);
const endDate = getDateFromStringOrThrow(
context.localCourse.settings.endDate,
"course end date"
);
const months = getMonthsBetweenDates(startDate, endDate);
return (
<>
{months.map((month) => (
<CalendarMonth
key={month.month + "" + month.year}
month={month}
localCourse={context.localCourse}
/>
))}
</>
);
}

View File

@@ -1,13 +1,68 @@
"use client"
"use client";
import { getDateFromStringOrThrow } from "@/models/local/timeUtils";
import { useCourseContext } from "../context/courseContext";
export default function Day({ day, month }: { day: Date; month: number }) {
const classes = "border rounded rounded-3 p-2 pb-4 m-1 ";
const context = useCourseContext();
const backgroundClass = day.getMonth() + 1 != month ? "" : "bg-slate-900";
const todaysAssignments = context.localCourse.modules
.flatMap((m) => m.assignments)
.filter((a) => {
const dueDate = getDateFromStringOrThrow(
a.dueAt,
"due at for assignment in day"
);
const isSame =
dueDate.getFullYear() === day.getFullYear() &&
dueDate.getMonth() === day.getMonth() &&
dueDate.getDate() === day.getDate();
if (a.name === "Chapter 3") console.log(a.name, dueDate, day, isSame);
return isSame;
});
const todaysQuizzes = context.localCourse.modules
.flatMap((m) => m.quizzes)
.filter((q) => {
const dueDate = getDateFromStringOrThrow(
q.dueAt,
"due at for quiz in day"
);
return (
dueDate.getFullYear() === day.getFullYear() &&
dueDate.getMonth() === day.getMonth() &&
dueDate.getDate() === day.getDate()
);
});
const todaysPages = context.localCourse.modules
.flatMap((m) => m.pages)
.filter((p) => {
const dueDate = getDateFromStringOrThrow(
p.dueAt,
"due at for page in day"
);
return (
dueDate.getFullYear() === day.getFullYear() &&
dueDate.getMonth() === day.getMonth() &&
dueDate.getDate() === day.getDate()
);
});
return (
<div className={classes + " " + backgroundClass}>
<div className={"border rounded rounded-3 p-2 pb-4 m-1 " + backgroundClass}>
{day.getDate()}
{/* <div>{day.getMonth()}</div> */}
<ul className="list-disc ms-4">
{todaysAssignments.map((a) => (
<li key={a.name}> {a.name}</li>
))}
{todaysQuizzes.map((q) => (
<li key={q.name}> {q.name}</li>
))}
{todaysPages.map((p) => (
<li key={p.name}> {p.name}</li>
))}
</ul>
</div>
);
}

View File

@@ -1,7 +1,9 @@
import { getDehydratedClient } from "@/app/layout";
import { HydrationBoundary } from "@tanstack/react-query";
import CourseContextProvider from "./context/CourseContextProvider";
import CourseDetails from "./CourseDetails";
import CourseCalendar from "./calendar/CourseCalendar";
import { HydrationBoundary } from "@tanstack/react-query";
import CourseSettings from "./CourseSettings";
import ModuleList from "./ModuleList";
export default async function CoursePage({
params: { courseName },
@@ -12,7 +14,17 @@ export default async function CoursePage({
return (
<HydrationBoundary state={dehydratedState}>
<CourseContextProvider localCourseName={courseName}>
<CourseDetails />
<div>
<CourseSettings />
<div className="flex flex-row">
<div className="grow">
<CourseCalendar />
</div>
<div className="w-96">
<ModuleList />
</div>
</div>
</div>
</CourseContextProvider>
</HydrationBoundary>
);

View File

@@ -6,8 +6,8 @@ import { assignmentMarkdownSerializer } from "./utils/assignmentMarkdownSerializ
export interface LocalAssignment {
name: string;
description: string;
lockAt?: string; // 21/08/2023 23:59:00
dueAt: string; // 21/08/2023 23:59:00
lockAt?: string; // 08/21/2023 23:59:00
dueAt: string; // 08/21/2023 23:59:00
localAssignmentGroupName?: string;
submissionTypes: AssignmentSubmissionType[];
allowedFileUploadExtensions: string[];

View File

@@ -9,8 +9,8 @@ describe("AssignmentMarkdownTests", () => {
const assignment: LocalAssignment = {
name: "test assignment",
description: "here is the description",
dueAt: "21/08/2023 23:59:00",
lockAt: "21/08/2023 23:59:00",
dueAt: "08/21/2023 23:59:00",
lockAt: "08/21/2023 23:59:00",
submissionTypes: [AssignmentSubmissionType.ONLINE_UPLOAD],
localAssignmentGroupName: "Final Project",
rubric: [
@@ -32,8 +32,8 @@ describe("AssignmentMarkdownTests", () => {
const assignment: LocalAssignment = {
name: "test assignment",
description: "here is the description",
dueAt: "21/08/2023 23:59:00",
lockAt: "21/08/2023 23:59:00",
dueAt: "08/21/2023 23:59:00",
lockAt: "08/21/2023 23:59:00",
submissionTypes: [AssignmentSubmissionType.ONLINE_UPLOAD],
localAssignmentGroupName: "Final Project",
rubric: [],
@@ -52,8 +52,8 @@ describe("AssignmentMarkdownTests", () => {
const assignment: LocalAssignment = {
name: "test assignment",
description: "here is the description",
dueAt: "21/08/2023 23:59:00",
lockAt: "21/08/2023 23:59:00",
dueAt: "08/21/2023 23:59:00",
lockAt: "08/21/2023 23:59:00",
submissionTypes: [],
localAssignmentGroupName: "Final Project",
rubric: [
@@ -75,7 +75,7 @@ describe("AssignmentMarkdownTests", () => {
const assignment: LocalAssignment = {
name: "test assignment",
description: "here is the description",
dueAt: "21/08/2023 23:59:00",
dueAt: "08/21/2023 23:59:00",
lockAt: undefined,
submissionTypes: [],
localAssignmentGroupName: "Final Project",
@@ -98,8 +98,8 @@ describe("AssignmentMarkdownTests", () => {
const assignment: LocalAssignment = {
name: "test assignment",
description: "",
dueAt: "21/08/2023 23:59:00",
lockAt: "21/08/2023 23:59:00",
dueAt: "08/21/2023 23:59:00",
lockAt: "08/21/2023 23:59:00",
submissionTypes: [],
localAssignmentGroupName: "Final Project",
rubric: [
@@ -121,8 +121,8 @@ describe("AssignmentMarkdownTests", () => {
const assignment: LocalAssignment = {
name: "test assignment",
description: "test assignment\n---\nsomestuff",
dueAt: "21/08/2023 23:59:00",
lockAt: "21/08/2023 23:59:00",
dueAt: "08/21/2023 23:59:00",
lockAt: "08/21/2023 23:59:00",
submissionTypes: [],
localAssignmentGroupName: "Final Project",
rubric: [],
@@ -141,8 +141,8 @@ describe("AssignmentMarkdownTests", () => {
const assignment: LocalAssignment = {
name: "test assignment",
description: "here is the description",
dueAt: "21/08/2023 23:59:00",
lockAt: "21/08/2023 23:59:00",
dueAt: "08/21/2023 23:59:00",
lockAt: "08/21/2023 23:59:00",
submissionTypes: [AssignmentSubmissionType.ONLINE_UPLOAD],
allowedFileUploadExtensions: ["pdf", "txt"],
localAssignmentGroupName: "Final Project",

View File

@@ -6,7 +6,7 @@ describe("PageMarkdownTests", () => {
const page: LocalCoursePage = {
name: "test title",
text: "test text content",
dueAt: "09/07/2024 23:59:00",
dueAt: "07/09/2024 23:59:00",
};
const pageMarkdownString = localPageMarkdownUtils.toMarkdown(page);

View File

@@ -9,8 +9,8 @@ describe("MatchingTests", () => {
Name: Test Quiz
ShuffleAnswers: true
OneQuestionAtATime: false
DueAt: 21/08/2023 23:59:00
LockAt: 21/08/2023 23:59:00
DueAt: 08/21/2023 23:59:00
LockAt: 08/21/2023 23:59:00
AssignmentGroup: Assignments
AllowedAttempts: -1
Description:
@@ -37,8 +37,8 @@ Match the following terms & definitions
Name: Test Quiz
ShuffleAnswers: true
OneQuestionAtATime: false
DueAt: 21/08/2023 23:59:00
LockAt: 21/08/2023 23:59:00
DueAt: 08/21/2023 23:59:00
LockAt: 08/21/2023 23:59:00
AssignmentGroup: Assignments
AllowedAttempts: -1
Description:
@@ -69,8 +69,8 @@ Match the following terms & definitions
Name: Test Quiz
ShuffleAnswers: true
OneQuestionAtATime: false
DueAt: 21/08/2023 23:59:00
LockAt: 21/08/2023 23:59:00
DueAt: 08/21/2023 23:59:00
LockAt: 08/21/2023 23:59:00
AssignmentGroup: Assignments
AllowedAttempts: -1
Description:
@@ -89,8 +89,8 @@ Match the following terms & definitions
Name: Test Quiz
ShuffleAnswers: true
OneQuestionAtATime: false
DueAt: 21/08/2023 23:59:00
LockAt: 21/08/2023 23:59:00
DueAt: 08/21/2023 23:59:00
LockAt: 08/21/2023 23:59:00
AssignmentGroup: Assignments
AllowedAttempts: -1
Description:
@@ -112,8 +112,8 @@ Match the following terms & definitions
Name: Test Quiz
ShuffleAnswers: true
OneQuestionAtATime: false
DueAt: 21/08/2023 23:59:00
LockAt: 21/08/2023 23:59:00
DueAt: 08/21/2023 23:59:00
LockAt: 08/21/2023 23:59:00
AssignmentGroup: Assignments
AllowedAttempts: -1
Description:

View File

@@ -9,8 +9,8 @@ describe("MultipleAnswersTests", () => {
const quiz: LocalQuiz = {
name: "Test Quiz",
description: "desc",
dueAt: "21/08/2023 23:59:00",
lockAt: "21/08/2023 23:59:00",
dueAt: "08/21/2023 23:59:00",
lockAt: "08/21/2023 23:59:00",
shuffleAnswers: true,
oneQuestionAtATime: false,
showCorrectAnswers: false,
@@ -45,8 +45,8 @@ oneline question
Name: Test Quiz
ShuffleAnswers: true
OneQuestionAtATime: false
DueAt: 21/08/2023 23:59:00
LockAt: 21/08/2023 23:59:00
DueAt: 08/21/2023 23:59:00
LockAt: 08/21/2023 23:59:00
AssignmentGroup: Assignments
AllowedAttempts: -1
Description: this is the

View File

@@ -10,8 +10,8 @@ describe("MultipleChoiceTests", () => {
const quiz: LocalQuiz = {
name: "Test Quiz",
description: "desc",
dueAt: "21/08/2023 23:59:00",
lockAt: "21/08/2023 23:59:00",
dueAt: "08/21/2023 23:59:00",
lockAt: "08/21/2023 23:59:00",
shuffleAnswers: true,
oneQuestionAtATime: false,
showCorrectAnswers: false,

View File

@@ -9,8 +9,8 @@ describe("QuizDeterministicChecks", () => {
const quiz: LocalQuiz = {
name: "Test Quiz",
description: "quiz description",
lockAt: "21/08/2023 23:59:00",
dueAt: "21/08/2023 23:59:00",
lockAt: "08/21/2023 23:59:00",
dueAt: "08/21/2023 23:59:00",
shuffleAnswers: true,
oneQuestionAtATime: true,
localAssignmentGroupName: "Assignments",
@@ -29,8 +29,8 @@ describe("QuizDeterministicChecks", () => {
const quiz: LocalQuiz = {
name: "Test Quiz",
description: "quiz description",
lockAt: "21/08/2023 23:59:00",
dueAt: "21/08/2023 23:59:00",
lockAt: "08/21/2023 23:59:00",
dueAt: "08/21/2023 23:59:00",
showCorrectAnswers: false,
shuffleAnswers: true,
oneQuestionAtATime: true,
@@ -49,8 +49,8 @@ describe("QuizDeterministicChecks", () => {
const quiz: LocalQuiz = {
name: "Test Quiz",
description: "quiz description",
lockAt: "21/08/2023 23:59:00",
dueAt: "21/08/2023 23:59:00",
lockAt: "08/21/2023 23:59:00",
dueAt: "08/21/2023 23:59:00",
shuffleAnswers: true,
oneQuestionAtATime: true,
localAssignmentGroupName: "Assignments",
@@ -77,8 +77,8 @@ describe("QuizDeterministicChecks", () => {
const quiz: LocalQuiz = {
name: "Test Quiz",
description: "quiz description",
lockAt: "21/08/2023 23:59:00",
dueAt: "21/08/2023 23:59:00",
lockAt: "08/21/2023 23:59:00",
dueAt: "08/21/2023 23:59:00",
shuffleAnswers: true,
oneQuestionAtATime: true,
localAssignmentGroupName: "Assignments",
@@ -105,8 +105,8 @@ describe("QuizDeterministicChecks", () => {
const quiz: LocalQuiz = {
name: "Test Quiz",
description: "quiz description",
lockAt: "21/08/2023 23:59:00",
dueAt: "21/08/2023 23:59:00",
lockAt: "08/21/2023 23:59:00",
dueAt: "08/21/2023 23:59:00",
shuffleAnswers: true,
oneQuestionAtATime: true,
localAssignmentGroupName: "Assignments",
@@ -136,8 +136,8 @@ describe("QuizDeterministicChecks", () => {
const quiz: LocalQuiz = {
name: "Test Quiz",
description: "quiz description",
lockAt: "21/08/2023 23:59:00",
dueAt: "21/08/2023 23:59:00",
lockAt: "08/21/2023 23:59:00",
dueAt: "08/21/2023 23:59:00",
shuffleAnswers: true,
oneQuestionAtATime: true,
password: undefined,
@@ -168,8 +168,8 @@ describe("QuizDeterministicChecks", () => {
const quiz: LocalQuiz = {
name: "Test Quiz",
description: "quiz description",
lockAt: "21/08/2023 23:59:00",
dueAt: "21/08/2023 23:59:00",
lockAt: "08/21/2023 23:59:00",
dueAt: "08/21/2023 23:59:00",
shuffleAnswers: true,
oneQuestionAtATime: true,
password: undefined,

View File

@@ -41,8 +41,8 @@ this is my description in markdown
Name: Test Quiz
ShuffleAnswers: true
OneQuestionAtATime: false
DueAt: 21/08/2023 23:59:00
LockAt: 21/08/2023 23:59:00
DueAt: 08/21/2023 23:59:00
LockAt: 08/21/2023 23:59:00
AssignmentGroup: Assignments
AllowedAttempts: -1
Description: this is the
@@ -72,8 +72,8 @@ Name: Test Quiz
Password: ${password}
ShuffleAnswers: true
OneQuestionAtATime: false
DueAt: 21/08/2023 23:59:00
LockAt: 21/08/2023 23:59:00
DueAt: 08/21/2023 23:59:00
LockAt: 08/21/2023 23:59:00
AssignmentGroup: Assignments
AllowedAttempts: -1
Description: this is the
@@ -93,8 +93,8 @@ Name: Test Quiz
ShuffleAnswers: true
OneQuestionAtATime: false
ShowCorrectAnswers: false
DueAt: 21/08/2023 23:59:00
LockAt: 21/08/2023 23:59:00
DueAt: 08/21/2023 23:59:00
LockAt: 08/21/2023 23:59:00
AssignmentGroup: Assignments
AllowedAttempts: -1
Description: this is the
@@ -113,8 +113,8 @@ description
Name: Test Quiz
ShuffleAnswers: true
OneQuestionAtATime: false
DueAt: 21/08/2023 23:59:00
LockAt: 21/08/2023 23:59:00
DueAt: 08/21/2023 23:59:00
LockAt: 08/21/2023 23:59:00
AssignmentGroup: Assignments
AllowedAttempts: -1
Description: this is the
@@ -153,8 +153,8 @@ b) false
Name: Test Quiz
ShuffleAnswers: true
OneQuestionAtATime: false
DueAt: 21/08/2023 23:59:00
LockAt: 21/08/2023 23:59:00
DueAt: 08/21/2023 23:59:00
LockAt: 08/21/2023 23:59:00
AssignmentGroup: Assignments
AllowedAttempts: -1
Description: this is the
@@ -185,8 +185,8 @@ b) false
Name: Test Quiz
ShuffleAnswers: true
OneQuestionAtATime: false
DueAt: 21/08/2023 23:59:00
LockAt: 21/08/2023 23:59:00
DueAt: 08/21/2023 23:59:00
LockAt: 08/21/2023 23:59:00
AssignmentGroup: Assignments
AllowedAttempts: -1
Description: this is the
@@ -213,8 +213,8 @@ short_answer`;
Name: Test Quiz
ShuffleAnswers: true
OneQuestionAtATime: false
DueAt: 21/08/2023 23:59:00
LockAt: 21/08/2023 23:59:00
DueAt: 08/21/2023 23:59:00
LockAt: 08/21/2023 23:59:00
AssignmentGroup: Assignments
AllowedAttempts: -1
Description: this is the
@@ -236,8 +236,8 @@ short answer
Name: Test Quiz
ShuffleAnswers: true
OneQuestionAtATime: false
DueAt: 21/08/2023 23:59:00
LockAt: 21/08/2023 23:59:00
DueAt: 08/21/2023 23:59:00
LockAt: 08/21/2023 23:59:00
AssignmentGroup: Assignments
AllowedAttempts: -1
Description: this is the

View File

@@ -9,8 +9,8 @@ describe("TextAnswerTests", () => {
Name: Test Quiz
ShuffleAnswers: true
OneQuestionAtATime: false
DueAt: 21/08/2023 23:59:00
LockAt: 21/08/2023 23:59:00
DueAt: 08/21/2023 23:59:00
LockAt: 08/21/2023 23:59:00
AssignmentGroup: Assignments
AllowedAttempts: -1
Description: this is the
@@ -34,8 +34,8 @@ essay
Name: Test Quiz
ShuffleAnswers: true
OneQuestionAtATime: false
DueAt: 21/08/2023 23:59:00
LockAt: 21/08/2023 23:59:00
DueAt: 08/21/2023 23:59:00
LockAt: 08/21/2023 23:59:00
AssignmentGroup: Assignments
AllowedAttempts: -1
Description: this is the
@@ -59,8 +59,8 @@ short answer
Name: Test Quiz
ShuffleAnswers: true
OneQuestionAtATime: false
DueAt: 21/08/2023 23:59:00
LockAt: 21/08/2023 23:59:00
DueAt: 08/21/2023 23:59:00
LockAt: 08/21/2023 23:59:00
AssignmentGroup: Assignments
AllowedAttempts: -1
Description: this is the
@@ -87,8 +87,8 @@ short_answer`;
Name: Test Quiz
ShuffleAnswers: true
OneQuestionAtATime: false
DueAt: 21/08/2023 23:59:00
LockAt: 21/08/2023 23:59:00
DueAt: 08/21/2023 23:59:00
LockAt: 08/21/2023 23:59:00
AssignmentGroup: Assignments
AllowedAttempts: -1
Description: this is the

View File

@@ -1,23 +1,31 @@
import { describe, it, expect } from "vitest";
import { getDateFromString } from "../timeUtils";
describe("Can properly handle expected date formats", () => {
it("can use AM/PM dates", () =>{
const dateString = "8/27/2024 1:00:00AM"
const dateObject = getDateFromString(dateString)
expect(dateObject).not.toBeUndefined()
})
it("can use 24 hour dates", () =>{
const dateString = "8/27/2024 23:95:00"
const dateObject = getDateFromString(dateString)
expect(dateObject).not.toBeUndefined()
})
it("can use ISO format", () =>{
const dateString = "2024-08-26T00:00:00.0000000"
const dateObject = getDateFromString(dateString)
expect(dateObject).not.toBeUndefined()
})
})
it("can use AM/PM dates", () => {
const dateString = "8/27/2024 1:00:00AM";
const dateObject = getDateFromString(dateString);
expect(dateObject).not.toBeUndefined();
});
it("can use 24 hour dates", () => {
const dateString = "8/27/2024 23:95:00";
const dateObject = getDateFromString(dateString);
expect(dateObject).not.toBeUndefined();
});
it("can use ISO format", () => {
const dateString = "2024-08-26T00:00:00.0000000";
const dateObject = getDateFromString(dateString);
expect(dateObject).not.toBeUndefined();
});
it("can get correct time from format", () => {
const dateString = "08/28/2024 23:59:00";
const dateObject = getDateFromString(dateString);
expect(dateObject?.getDate()).toBe(28);
expect(dateObject?.getMonth()).toBe(8 - 1); // 0 based
expect(dateObject?.getFullYear()).toBe(2024);
expect(dateObject?.getMinutes()).toBe(59);
expect(dateObject?.getHours()).toBe(23);
expect(dateObject?.getSeconds()).toBe(0);
});
});

View File

@@ -24,7 +24,7 @@ const _getDateFromMilitary = (
datePart: string,
timePart: string
): Date | undefined => {
const [day, month, year] = datePart.split("/").map(Number);
const [month, day, year] = datePart.split("/").map(Number);
const [hours, minutes, seconds] = timePart.split(":").map(Number);
const date = new Date(year, month - 1, day, hours, minutes, seconds);
@@ -86,5 +86,5 @@ export const dateToMarkdownString = (date: Date) => {
const stringMinutes = String(date.getMinutes()).padStart(2, "0");
const stringSeconds = String(date.getSeconds()).padStart(2, "0");
return `${stringDay}/${stringMonth}/${stringYear} ${stringHours}:${stringMinutes}:${stringSeconds}`;
return `${stringMonth}/${stringDay}/${stringYear} ${stringHours}:${stringMinutes}:${stringSeconds}`;
};

View File

@@ -10,8 +10,8 @@ describe("CourseDifferencesChangesTests", () => {
name: "Test Course",
assignmentGroups: [],
daysOfWeek: [],
startDate: "09/07/2024 23:59:00",
endDate: "09/07/2024 23:59:00",
startDate: "07/09/2024 23:59:00",
endDate: "07/09/2024 23:59:00",
defaultDueTime: {
hour: 23,
minute: 59,
@@ -40,8 +40,8 @@ describe("CourseDifferencesChangesTests", () => {
name: "Test Course",
assignmentGroups: [],
daysOfWeek: [],
startDate: "09/07/2024 23:59:00",
endDate: "09/07/2024 23:59:00",
startDate: "07/09/2024 23:59:00",
endDate: "07/09/2024 23:59:00",
defaultDueTime: {
hour: 23,
minute: 59,
@@ -74,8 +74,8 @@ describe("CourseDifferencesChangesTests", () => {
name: "Test Course",
assignmentGroups: [],
daysOfWeek: [],
startDate: "09/07/2024 23:59:00",
endDate: "09/07/2024 23:59:00",
startDate: "07/09/2024 23:59:00",
endDate: "07/09/2024 23:59:00",
defaultDueTime: {
hour: 23,
minute: 59,
@@ -88,7 +88,7 @@ describe("CourseDifferencesChangesTests", () => {
{
name: "test assignment",
description: "",
dueAt: "09/07/2024 23:59:00",
dueAt: "07/09/2024 23:59:00",
submissionTypes: [],
allowedFileUploadExtensions: [],
rubric: [],
@@ -108,7 +108,7 @@ describe("CourseDifferencesChangesTests", () => {
{
name: "test assignment",
description: "new description",
dueAt: "09/07/2024 23:59:00",
dueAt: "07/09/2024 23:59:00",
submissionTypes: [],
allowedFileUploadExtensions: [],
rubric: [],
@@ -130,7 +130,7 @@ describe("CourseDifferencesChangesTests", () => {
});
it("can properly ignore unchanged modules", () => {
const commonDate = "09/07/2024 23:59:00";
const commonDate = "07/09/2024 23:59:00";
const oldCourse: LocalCourse = {
settings: {
name: "Test Course",
@@ -171,7 +171,7 @@ describe("CourseDifferencesChangesTests", () => {
});
it("only changed assignment represented", () => {
const commonDate = "09/07/2024 23:59:00";
const commonDate = "07/09/2024 23:59:00";
const oldCourse: LocalCourse = {
settings: {
name: "Test Course",
@@ -249,7 +249,7 @@ describe("CourseDifferencesChangesTests", () => {
});
it("identical quizzes ignored", () => {
const commonDate = "09/07/2024 23:59:00";
const commonDate = "07/09/2024 23:59:00";
const oldCourse: LocalCourse = {
settings: {
name: "Test Course",
@@ -292,7 +292,7 @@ describe("CourseDifferencesChangesTests", () => {
});
it("can detect different quiz", () => {
const commonDate = "09/07/2024 23:59:00";
const commonDate = "07/09/2024 23:59:00";
const oldCourse: LocalCourse = {
settings: {
name: "Test Course",
@@ -359,7 +359,7 @@ describe("CourseDifferencesChangesTests", () => {
});
it("can detect only different quiz when other quizzes stay", () => {
const commonDate = "09/07/2024 23:59:00";
const commonDate = "07/09/2024 23:59:00";
const oldCourse: LocalCourse = {
settings: {
name: "Test Course",
@@ -433,7 +433,7 @@ describe("CourseDifferencesChangesTests", () => {
});
it("same pages not detected", () => {
const commonDate = "09/07/2024 23:59:00";
const commonDate = "07/09/2024 23:59:00";
const oldCourse: LocalCourse = {
settings: {
name: "Test Course",
@@ -471,7 +471,7 @@ describe("CourseDifferencesChangesTests", () => {
});
it("different page detected", () => {
const commonDate = "09/07/2024 23:59:00";
const commonDate = "07/09/2024 23:59:00";
const oldCourse: LocalCourse = {
settings: {
name: "Test Course",
@@ -527,7 +527,7 @@ describe("CourseDifferencesChangesTests", () => {
});
it("different page detected but not same page", () => {
const commonDate = "09/07/2024 23:59:00";
const commonDate = "07/09/2024 23:59:00";
const oldCourse: LocalCourse = {
settings: {
name: "Test Course",

View File

@@ -9,8 +9,8 @@ describe("CourseDifferencesDeletionsTests", () => {
name: "test course",
assignmentGroups: [],
daysOfWeek: [],
startDate: "09/07/2024 23:59:00",
endDate: "09/07/2024 23:59:00",
startDate: "07/09/2024 23:59:00",
endDate: "07/09/2024 23:59:00",
defaultDueTime: {
hour: 23,
minute: 59,
@@ -51,8 +51,8 @@ describe("CourseDifferencesDeletionsTests", () => {
name: "test course",
assignmentGroups: [],
daysOfWeek: [],
startDate: "09/07/2024 23:59:00",
endDate: "09/07/2024 23:59:00",
startDate: "07/09/2024 23:59:00",
endDate: "07/09/2024 23:59:00",
defaultDueTime: {
hour: 23,
minute: 59,
@@ -94,8 +94,8 @@ describe("CourseDifferencesDeletionsTests", () => {
name: "test course",
assignmentGroups: [],
daysOfWeek: [],
startDate: "09/07/2024 23:59:00",
endDate: "09/07/2024 23:59:00",
startDate: "07/09/2024 23:59:00",
endDate: "07/09/2024 23:59:00",
defaultDueTime: {
hour: 23,
minute: 59,
@@ -108,7 +108,7 @@ describe("CourseDifferencesDeletionsTests", () => {
{
name: "test assignment",
description: "test description",
dueAt: "09/07/2024 23:59:00",
dueAt: "07/09/2024 23:59:00",
submissionTypes: [],
allowedFileUploadExtensions: [],
rubric: [],
@@ -128,7 +128,7 @@ describe("CourseDifferencesDeletionsTests", () => {
{
name: "test assignment changed name",
description: "test description",
dueAt: "09/07/2024 23:59:00",
dueAt: "07/09/2024 23:59:00",
submissionTypes: [],
allowedFileUploadExtensions: [],
rubric: [],
@@ -159,8 +159,8 @@ describe("CourseDifferencesDeletionsTests", () => {
name: "test course",
assignmentGroups: [],
daysOfWeek: [],
startDate: "09/07/2024 23:59:00",
endDate: "09/07/2024 23:59:00",
startDate: "07/09/2024 23:59:00",
endDate: "07/09/2024 23:59:00",
defaultDueTime: {
hour: 23,
minute: 59,
@@ -173,7 +173,7 @@ describe("CourseDifferencesDeletionsTests", () => {
{
name: "test assignment",
description: "test description",
dueAt: "09/07/2024 23:59:00",
dueAt: "07/09/2024 23:59:00",
submissionTypes: [],
allowedFileUploadExtensions: [],
rubric: [],
@@ -193,7 +193,7 @@ describe("CourseDifferencesDeletionsTests", () => {
{
name: "test assignment",
description: "test description",
dueAt: "09/07/2024 23:59:00",
dueAt: "07/09/2024 23:59:00",
submissionTypes: [],
allowedFileUploadExtensions: [],
rubric: [],
@@ -219,8 +219,8 @@ describe("CourseDifferencesDeletionsTests", () => {
name: "test course",
assignmentGroups: [],
daysOfWeek: [],
startDate: "09/07/2024 23:59:00",
endDate: "09/07/2024 23:59:00",
startDate: "07/09/2024 23:59:00",
endDate: "07/09/2024 23:59:00",
defaultDueTime: {
hour: 23,
minute: 59,
@@ -233,7 +233,7 @@ describe("CourseDifferencesDeletionsTests", () => {
{
name: "test assignment",
description: "test description",
dueAt: "09/07/2024 23:59:00",
dueAt: "07/09/2024 23:59:00",
submissionTypes: [],
allowedFileUploadExtensions: [],
rubric: [],
@@ -241,7 +241,7 @@ describe("CourseDifferencesDeletionsTests", () => {
{
name: "test assignment 2",
description: "test description",
dueAt: "09/07/2024 23:59:00",
dueAt: "07/09/2024 23:59:00",
submissionTypes: [],
allowedFileUploadExtensions: [],
rubric: [],
@@ -261,7 +261,7 @@ describe("CourseDifferencesDeletionsTests", () => {
{
name: "test assignment",
description: "test description",
dueAt: "09/07/2024 23:59:00",
dueAt: "07/09/2024 23:59:00",
submissionTypes: [],
allowedFileUploadExtensions: [],
rubric: [],
@@ -269,7 +269,7 @@ describe("CourseDifferencesDeletionsTests", () => {
{
name: "test assignment 2 changed",
description: "test description",
dueAt: "09/07/2024 23:59:00",
dueAt: "07/09/2024 23:59:00",
submissionTypes: [],
allowedFileUploadExtensions: [],
rubric: [],
@@ -299,8 +299,8 @@ describe("CourseDifferencesDeletionsTests", () => {
name: "test course",
assignmentGroups: [],
daysOfWeek: [],
startDate: "09/07/2024 23:59:00",
endDate: "09/07/2024 23:59:00",
startDate: "07/09/2024 23:59:00",
endDate: "07/09/2024 23:59:00",
defaultDueTime: {
hour: 23,
minute: 59,
@@ -314,7 +314,7 @@ describe("CourseDifferencesDeletionsTests", () => {
{
name: "Test Quiz",
description: "test description",
dueAt: "09/07/2024 23:59:00",
dueAt: "07/09/2024 23:59:00",
shuffleAnswers: false,
showCorrectAnswers: false,
oneQuestionAtATime: false,
@@ -324,7 +324,7 @@ describe("CourseDifferencesDeletionsTests", () => {
{
name: "Test Quiz 2",
description: "test description",
dueAt: "09/07/2024 23:59:00",
dueAt: "07/09/2024 23:59:00",
shuffleAnswers: false,
showCorrectAnswers: false,
oneQuestionAtATime: false,
@@ -346,7 +346,7 @@ describe("CourseDifferencesDeletionsTests", () => {
{
name: "Test Quiz",
description: "test description",
dueAt: "09/07/2024 23:59:00",
dueAt: "07/09/2024 23:59:00",
shuffleAnswers: false,
showCorrectAnswers: false,
oneQuestionAtATime: false,
@@ -356,7 +356,7 @@ describe("CourseDifferencesDeletionsTests", () => {
{
name: "Test Quiz 3",
description: "test description",
dueAt: "09/07/2024 23:59:00",
dueAt: "07/09/2024 23:59:00",
shuffleAnswers: false,
showCorrectAnswers: false,
oneQuestionAtATime: false,
@@ -387,8 +387,8 @@ describe("CourseDifferencesDeletionsTests", () => {
name: "test course",
assignmentGroups: [],
daysOfWeek: [],
startDate: "09/07/2024 23:59:00",
endDate: "09/07/2024 23:59:00",
startDate: "07/09/2024 23:59:00",
endDate: "07/09/2024 23:59:00",
defaultDueTime: {
hour: 23,
minute: 59,
@@ -403,12 +403,12 @@ describe("CourseDifferencesDeletionsTests", () => {
{
name: "Test Page",
text: "test contents",
dueAt: "09/07/2024 23:59:00",
dueAt: "07/09/2024 23:59:00",
},
{
name: "Test Page 2",
text: "test contents",
dueAt: "09/07/2024 23:59:00",
dueAt: "07/09/2024 23:59:00",
},
],
},
@@ -425,12 +425,12 @@ describe("CourseDifferencesDeletionsTests", () => {
{
name: "Test Page",
text: "test contents",
dueAt: "09/07/2024 23:59:00",
dueAt: "07/09/2024 23:59:00",
},
{
name: "Test Page 3",
text: "test contents",
dueAt: "09/07/2024 23:59:00",
dueAt: "07/09/2024 23:59:00",
},
],
},

View File

@@ -21,8 +21,8 @@ describe("FileStorageTests", () => {
name: "test empty course",
assignmentGroups: [],
daysOfWeek: [],
startDate: "09/07/2024 23:59:00",
endDate: "09/07/2024 23:59:00",
startDate: "07/09/2024 23:59:00",
endDate: "07/09/2024 23:59:00",
defaultDueTime: { hour: 1, minute: 59 },
},
modules: [],
@@ -44,8 +44,8 @@ describe("FileStorageTests", () => {
assignmentGroups: [],
name: "Test Course with settings",
daysOfWeek: [DayOfWeek.Monday, DayOfWeek.Wednesday],
startDate: "09/07/2024 23:59:00",
endDate: "09/07/2024 23:59:00",
startDate: "07/09/2024 23:59:00",
endDate: "07/09/2024 23:59:00",
defaultDueTime: { hour: 1, minute: 59 },
},
modules: [],
@@ -67,8 +67,8 @@ describe("FileStorageTests", () => {
name: "Test Course with modules",
assignmentGroups: [],
daysOfWeek: [],
startDate: "09/07/2024 23:59:00",
endDate: "09/07/2024 23:59:00",
startDate: "07/09/2024 23:59:00",
endDate: "07/09/2024 23:59:00",
defaultDueTime: { hour: 1, minute: 59 },
},
modules: [
@@ -97,8 +97,8 @@ describe("FileStorageTests", () => {
name: "Test Course with modules and assignments",
assignmentGroups: [],
daysOfWeek: [],
startDate: "09/07/2024 23:59:00",
endDate: "09/07/2024 23:59:00",
startDate: "07/09/2024 23:59:00",
endDate: "07/09/2024 23:59:00",
defaultDueTime: { hour: 1, minute: 59 },
},
modules: [
@@ -108,8 +108,8 @@ describe("FileStorageTests", () => {
{
name: "test assignment",
description: "here is the description",
dueAt: "09/07/2024 23:59:00",
lockAt: "09/07/2024 23:59:00",
dueAt: "07/09/2024 23:59:00",
lockAt: "07/09/2024 23:59:00",
submissionTypes: [AssignmentSubmissionType.ONLINE_UPLOAD],
localAssignmentGroupName: "Final Project",
rubric: [
@@ -143,8 +143,8 @@ describe("FileStorageTests", () => {
name: "Test Course with modules and quiz",
assignmentGroups: [],
daysOfWeek: [],
startDate: "09/07/2024 23:59:00",
endDate: "09/07/2024 23:59:00",
startDate: "07/09/2024 23:59:00",
endDate: "07/09/2024 23:59:00",
defaultDueTime: { hour: 1, minute: 59 },
},
modules: [
@@ -155,8 +155,8 @@ describe("FileStorageTests", () => {
{
name: "Test Quiz",
description: "quiz description",
lockAt: "09/07/2024 12:05:00",
dueAt: "09/07/2024 12:05:00",
lockAt: "07/09/2024 12:05:00",
dueAt: "07/09/2024 12:05:00",
shuffleAnswers: true,
oneQuestionAtATime: true,
localAssignmentGroupName: "Assignments",
@@ -196,8 +196,8 @@ describe("FileStorageTests", () => {
name: "Test Course with lots of data",
assignmentGroups: [],
daysOfWeek: [DayOfWeek.Monday, DayOfWeek.Wednesday],
startDate: "09/07/2024 23:59:00",
endDate: "09/07/2024 23:59:00",
startDate: "07/09/2024 23:59:00",
endDate: "07/09/2024 23:59:00",
defaultDueTime: { hour: 1, minute: 59 },
},
modules: [
@@ -207,8 +207,8 @@ describe("FileStorageTests", () => {
{
name: "test assignment",
description: "here is the description",
dueAt: "09/07/2024 23:59:00",
lockAt: "09/07/2024 23:59:00",
dueAt: "07/09/2024 23:59:00",
lockAt: "07/09/2024 23:59:00",
submissionTypes: [AssignmentSubmissionType.ONLINE_UPLOAD],
localAssignmentGroupName: "Final Project",
rubric: [
@@ -222,8 +222,8 @@ describe("FileStorageTests", () => {
{
name: "Test Quiz",
description: "quiz description",
lockAt: "09/07/2024 23:59:00",
dueAt: "09/07/2024 23:59:00",
lockAt: "07/09/2024 23:59:00",
dueAt: "07/09/2024 23:59:00",
shuffleAnswers: true,
oneQuestionAtATime: false,
localAssignmentGroupName: "someId",
@@ -261,8 +261,8 @@ describe("FileStorageTests", () => {
name: "Test Course with page",
assignmentGroups: [],
daysOfWeek: [DayOfWeek.Monday, DayOfWeek.Wednesday],
startDate: "09/07/2024 23:59:00",
endDate: "09/07/2024 23:59:00",
startDate: "07/09/2024 23:59:00",
endDate: "07/09/2024 23:59:00",
defaultDueTime: { hour: 1, minute: 59 },
},
modules: [
@@ -273,7 +273,7 @@ describe("FileStorageTests", () => {
pages: [
{
name: "test page persistence",
dueAt: "09/07/2024 23:59:00",
dueAt: "07/09/2024 23:59:00",
text: "this is some\n## markdown\n",
},
],