Skip to content

Commit

Permalink
🗺️ Add new campuses, ensure campus names get updated (#72)
Browse files Browse the repository at this point in the history
This change updates the campus list to represent the latest set shown on
MyPurdue.

It also includes an update to ensure database Campus entries are updated
to match the latest names.
  • Loading branch information
haydenmc authored Sep 3, 2024
1 parent 69e939f commit f917a97
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 14 deletions.
13 changes: 12 additions & 1 deletion src/CatalogSync/FastSync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,18 @@ private DatabaseCampus FetchOrAddCampus(string campusCode, string campusName)
else
{
campus = dbContext.Campuses.SingleOrDefault(c => (c.Code == campusCode));
if (campus == null)
if (campus != null)
{
// Sometimes the campus name will change despite having the same code
if (campus.Name != campusName)
{
campus.Name = campusName;
var campusEntry = dbContext.Entry(campus);
campusEntry.Property(s => s.Name).CurrentValue = campusName;
campusEntry.State = EntityState.Modified;
}
}
else
{
campus = new DatabaseCampus()
{
Expand Down
28 changes: 15 additions & 13 deletions src/Scraper/MyPurdueScraper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -368,22 +368,24 @@ private record SectionListInfo
// Tracked here: https://github.com/Purdue-io/PurdueApi/issues/55
private static readonly Dictionary<string, string> CampusNamesToShortCodes = new()
{
// Updated 2024-09-02 to match the list reported by
// https://selfservice.mypurdue.purdue.edu/prod/bwckschd.p_disp_dyn_sched
{ "Indianapolis and W Lafayette Campus", "PIN" },
{ "SW Anderson Campus", "TAN" },
{ "SW Columbus Campus", "TCO" },
{ "SW Indianapolis Intl Airport Campus", "TDY" },
{ "SW Kokomo Campus", "TKO" },
{ "SW New Albany Campus", "TNA" },
{ "SW Richmond Campus", "TRI" },
{ "SW South Bend Campus", "TSB" },
{ "SW Subaru Manufacturing Campus Campus", "TLF" },
{ "SW Vincennes Campus", "TVN" },
{ "West Lafayette Campus", "PWL" },
{ "West Lafayette Continuing Ed Campus", "CEC" },
{ "IUPUI Campus", "PIU" },
{ "New Albany Campus", "TNA" },
{ "Richmond Campus", "TRI" },
{ "Lafayette Campus", "TLF" },
{ "Anderson Campus", "TAN" },
{ "South Bend Campus", "TSB" },
{ "Columbus Campus", "TCO" },
{ "Indianapolis Campus", "TDY" },
{ "Kokomo Campus", "TKO" },
{ "Vincennes Campus", "TVN" },
{ "Greensburg Campus", "TGB" },
{ "Concurrent Credit Campus", "CC" },
// These entries do not appear on the course schedule search page,
// but are still found in section listings
{ "Dual Campus Campus", "TDC" },
{ "Indianapolis and W Lafayette Campus", "PIN" },
{ "Concurrent Credit Campus", "CC" },
};

// The loss of authenticated APIs removed our source of information for
Expand Down

0 comments on commit f917a97

Please sign in to comment.