Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

280 feature request indicate most recent semester taught #340

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from

Conversation

AbhiramTadepalli
Copy link
Contributor

Overview

When scanning search results, some professors may have not taught in a while (making them less viable options)

Implements #280

What Changed

Added a most_recent_semester prop to the GradesType type, which is filled in calculateGrades (dashboard/index.tsx)
Then, call that prop to fill the badge in searchResultsTable.tsx's row

Other Notes

@AbhiramTadepalli AbhiramTadepalli linked an issue Jan 13, 2025 that may be closed by this pull request
Copy link

vercel bot commented Jan 13, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
utd-trends ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 26, 2025 1:36am

@AbhiramTadepalli
Copy link
Contributor Author

Should I make the chip light gray?

@AbhiramTadepalli
Copy link
Contributor Author

How should it behave when the window width shrinks? Should it wrap alongside the name or always stay to the right of the name?

@AbhiramTadepalli
Copy link
Contributor Author

AbhiramTadepalli commented Jan 13, 2025

An issue is if there is no grade data for the current semester, but it is being taught (like F24 as of 1-13-2025), it shows S24 only as the last semester taught.

If I use section data from coursebook, I can do this properly I think.

@AbhiramTadepalli
Copy link
Contributor Author

#287 @GovindRangappa I'm going to let you finish this, but I think I've done most of the logic for it. You can use the same chip/badge that I'm using here but instead of "F24" keep something like "New professor" or just "new"?

@AbhiramTadepalli
Copy link
Contributor Author

AbhiramTadepalli commented Jan 13, 2025

What should the text be:
(1) in the chip: Is "S24" descriptive enough in context of the page? Should it be "recent: S24"? What do we think?
(2) in the tooltip: "Last taught in: Fall 2023" is okay?

… filter can display "2024 Fall" by passing in a boolean
@AbhiramTadepalli
Copy link
Contributor Author

AbhiramTadepalli commented Jan 13, 2025

If I use data from coursebook, I can do this properly I think.

This is how we get the current semester:

if (mm <= 5)
      // jan - may
      season = 'S';
    else season = 'F';

Coursebook releases professors for the upcoming semester a month or 2 before currentSemester changes. Should I add an if so that in December, it shows the "last semester taught" as "Fall 2024" instead of "Spring 2025"?

@AbhiramTadepalli
Copy link
Contributor Author

AbhiramTadepalli commented Jan 25, 2025

Related to the above comment. Just voicing some unstructured thoughts:

I call the course API, which returns an array of course objects with section IDs. Each element in the array is an iteration of the same course, for each academic year. I sort the courses and pick the newest one. Until March 31st, 2025, this will be the 2024-2025 academic-year course object. In this object, the section IDs consist of all the sections taught in Summer 2024, Fall 2024, and Spring 2025.

Before October 21st, 2024, only 2024 Summer and Fall sections are returned. After, Summer (2024), Fall (2024), and Spring (2025) courses are returned.

Now what I do is take ALL these section IDs and fetch the section API with them. I now have an array of section objects.
Remember, the goal is to indicate the most recent semester that a professor is/will be teaching.

Since grade data lags behind the current session by at least a semester, using grade data to indicate when Scott Dollinger last taught CS 3377 would show S24, when he actually taught in F24 AND we know will be teaching in S25.

My idea is to use the sections we got from the course api (coursebook) and see if it is needed to update it to something more recent than what the grades show. Ig I'll map the array of sections to an array of {profId: string, sem: string} objects.

Cases

On, Oct 25th, 2024, I see that Scott Dollinger will teach in S25 from the sections. I see that Scott Dollnger is teaching in F24 from the sections. I see that his most recent grades are from S24. Logically, I want the most_recent_semester to be F24. I will compare the current semester (a function calculates and returns F24) to the new array with profId and sem. Since I find a match, I'll update most_recent_semester to F24.

On January 25th, 2025, I see that Scott Dollinger taught in F24 & S25. Since the current-semester-function returns S25 now, I find the match and update most_recent_semester

On January 25th, 2025, I see that John Cole taught in F24. Grade data shows F23. Current Sem is S25: no match in the array. John Cole's profId matches for F24, and since F24 > F23, I update most_recent_semester.

By like Feb or March, I'd hope that grade data catches up to F24...

On March 31st, 2025, the next academic year's courses come out. Also U25 and F25 sections release. When I call the course API, I get the course for the 2025-2026 academic year. The sections for U25 and F25 are returned. Grade data is only until F24, so most_recent_semester will be stuck at F24 for Scott Dollinger even though he's teaching currently in S25. What do we do?

@AbhiramTadepalli
Copy link
Contributor Author

AbhiramTadepalli commented Jan 25, 2025

What do we do?

if (most_recent_sem != currentSem && currentSem is not in the array of sections) // only happens in the Spring
   check the previous academic year's sections and update
else if (most_recent_sem != currentSem) // currentSem IS in the array
   check the current academic year's sections and update

So we need to get the sections from 2 academic sections in the spring, and just the 1 academic session otherwise, but I'll just get both cuz im lazy

@AbhiramTadepalli
Copy link
Contributor Author

AbhiramTadepalli commented Jan 26, 2025

in index.tsx:

for section data

  • Created a useState dictionary for sectionsForCourses: [key: string]: GenericFetchedData<SectionData[]>
  • A useEffect to fetch sections for each course is called every time courses change (courses from the SearchTerms)
    This is how we fetchSectionsDataForCourse():
  1. fetchCourseData() from the api/course endpoint. THIS FUNCTION IS DUPLICATED FROM src\components\overview\CourseOverview\courseOverview.tsx
  2. Each Course returns an array of section ID's. fetchSectionData() for each .
  3. Store the array of sections for each course in the dictionary sectionsForCourses. The key is based on prefix and number.

for professor data (I just need the _id tbh)

  • Created a useState ductionary for profsData: [key: string]: GenericFetchedData`
  • A useEffect to fetch professor data is called every time the search results change (course-professsor combos)
    This is how we fetch professor data:
  1. For each professor, fetch from the api/professor endpoint THIS FUNCTION IS DUPLICATED FROM src\components\overview\ProfessorOverview\professorOverview.tsx
  2. Store the professors' data in the dictionary profsData. The key is based on profFirst and profLast.

in searchResultsTable.tsx:

Modified the props to take in a dictionary of section-arrays: sectionsDataForCourse: { [key: string]: GenericFetchedData<SectionData[]> }.
Also recieves a dictionary of professors: professors: { [key: string]: GenericFetchedData<ProfessorInterface> }

Inside each Row, the function getMostRecentSemester does this:

  1. Gets the current long semester based on the date. The most_recent_semester_from_grades based on the grade distribution data (which is 1-semester out of date, generally) is passed in.
  2. Filters the array of sections (for the course) by professor. professorSections stores all the sections this professor taught/will teach in the current academic year.
  3. A while loop decrements the semester until (a) the semester goes below (older) the most_recent_semester_from_grades OR (b) professorSections contains the semester in this iteration of the while loop. This ensures that the most recent semester a professor taught from coursebook or from the gradebook is returned.
  4. By default, it returns most_recent_semester_from_grades

In the Row Component:

The tooltip and the chip both call getMostRecentSemester().

…book (more recent than the grade distribution data)
@AbhiramTadepalli
Copy link
Contributor Author

For Professor X, who we have data from 22S for but most_recent_semester is 25S, should we include them in the RECENT filter?

@AbhiramTadepalli
Copy link
Contributor Author

Should we have a chip for the Overall result? If we do, it would indicate the most recent semester the course it was offered or the professor taught. Could be confusing?

@AbhiramTadepalli
Copy link
Contributor Author

@TyHil a looot of questions sorry but I'm trying to wrap my head around this. Some of this foundation impacts #287 #311

@TyHil
Copy link
Member

TyHil commented Jan 28, 2025

Should I make the chip light gray?

There's a MUI chip component if you're not already using it.

How should it behave when the window width shrinks? Should it wrap alongside the name or always stay to the right of the name?

Maybe we can get a design opinion on this to make this less intrusive. Like just a little warning icon in the corner of a result that hasn't been taught in a semester or 2. The current design is just real hard to scan.

Coursebook releases professors for the upcoming semester a month or 2 before currentSemester changes. Should I add an if so that in December, it shows the "last semester taught" as "Fall 2024" instead of "Spring 2025"?

Sounds good.

For Professor X, who we have data from 22S for but most_recent_semester is 25S, should we include them in the RECENT filter?

Yeah, if it's not too difficult.

Should we have a chip for the Overall result? If we do, it would indicate the most recent semester the course it was offered or the professor taught. Could be confusing?

I think this makes sense logically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] Indicate Most Recent Semester Taught
2 participants