Skip to content

Commit

Permalink
Fix seatsavailable, calendar ui
Browse files Browse the repository at this point in the history
  • Loading branch information
DCRepublic committed Nov 11, 2024
1 parent a17d7a3 commit e0274c7
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 47 deletions.
1 change: 0 additions & 1 deletion app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ async function getUniquCodes() {
daCodes.push(codes[i].code);
}
}
console.log(daCodes);

return daCodes;
}
Expand Down
6 changes: 4 additions & 2 deletions components/Calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ export default function Calendar(props: any) {
/>
*/}

<b className="font-sans p-2"> {eventInfo.timeText}</b>
<div className="font-sans p-2">{eventInfo.event.title}</div>
<b className="font-sans text-[9px] ml-1 mt-1">{eventInfo.timeText}</b>
<div className="font-sans text-[10px] ml-1 ">
{eventInfo.event.title}
</div>
</Card>
);
}
Expand Down
9 changes: 7 additions & 2 deletions components/CourseCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ async function updatePlan(course: any) {
}

export default function CourseCard(props: any) {
console.log(props.course);
const color = generateColorFromName(props.course.subject);

const color_mappings: { [key: string]: string } = {
Expand Down Expand Up @@ -181,13 +180,19 @@ export default function CourseCard(props: any) {
</div>
)}
</div>
{props.course.seatsAvailable >= 0 && (
{props.course.seatsAvailable == 0 ? (
<div className="flex flex-row items-end pt-4 gap-2">
<div className="font-medium text-slate">
No available seats left for this section
</div>
<Error color="error" />
</div>
) : (
<div className="flex flex-row ml-auto pt-4 gap-2">
<div className="font-medium text-slate">
Seats Available: {props.course.seatsAvailable}
</div>
</div>
)}
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion components/CreatePlan.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default function CreatePlan(props: any) {

const fetcher = (url: any) => fetch(url).then((r) => r.json());
const { data, isLoading, error } = useSWR("/api/getplancourses", fetcher, {
refreshInterval: 1000,
refreshInterval: 800,
});

const {
Expand Down
76 changes: 35 additions & 41 deletions components/FullCourseList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ async function getCourses(
},
],
where: {
...(query
...(term
? {
...(term
? {
year: term,
}
: {}),
//year: term,
year: term,
}
: {}),
//year: term,

...(query
? {
OR: [
{
courseTitle: {
Expand Down Expand Up @@ -85,42 +85,36 @@ async function getCourses(
},
},
],
}
: {}),

...(startTime.length > 0
? {
facultyMeet: {
meetingTimes: {
beginTime: {
in: startTime,
},
},
},
}
: {}),
...(startTime.length > 0
? {
facultyMeet: {
meetingTimes: {
beginTime: {
in: startTime,
},
},
},
}
: {}),

...(dotw.length > 0
? {
facultyMeet: {
meetingTimes: {
is: {
monday: dotw.includes("monday") ? true : Prisma.skip,
tuesday: dotw.includes("tuesday") ? true : Prisma.skip,
wednesday: dotw.includes("wednesday")
? true
: Prisma.skip,
thursday: dotw.includes("thursday")
? true
: Prisma.skip,
friday: dotw.includes("friday") ? true : Prisma.skip,
saturday: dotw.includes("saturday")
? true
: Prisma.skip,
sunday: dotw.includes("sunday") ? true : Prisma.skip,
},
},
},
}
: {}),
...(dotw.length > 0
? {
facultyMeet: {
meetingTimes: {
is: {
monday: dotw.includes("monday") ? true : Prisma.skip,
tuesday: dotw.includes("tuesday") ? true : Prisma.skip,
wednesday: dotw.includes("wednesday") ? true : Prisma.skip,
thursday: dotw.includes("thursday") ? true : Prisma.skip,
friday: dotw.includes("friday") ? true : Prisma.skip,
saturday: dotw.includes("saturday") ? true : Prisma.skip,
sunday: dotw.includes("sunday") ? true : Prisma.skip,
},
},
},
}
: {}),
},
Expand Down

0 comments on commit e0274c7

Please sign in to comment.