Skip to content

Commit

Permalink
Merge branch 'martig7/issue801' of https://github.com/YACS-RCOS/yacs.n
Browse files Browse the repository at this point in the history
…into martig7/issue801
  • Loading branch information
martig7 committed Oct 13, 2023
2 parents 56bc408 + 47a6213 commit 6dc371a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
12 changes: 7 additions & 5 deletions rpi_data/modules/course.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import time
class Course:
name:str
credits:int
Expand All @@ -23,8 +24,8 @@ class Course:
pre:str
co:str
major:str
#Info will be an array of strings:
# [name,credits,days,stime,etime,profs,loc,max,curr,rem,dept,sdate,enddate,semester TODO:ADD,crn,course_level TODO: Get from short name,section,short,long,desc,raw,prereq,coreq,school]
school:str
#Info will be an array of strings:
# [crn, major, code, section, credits, name, days, stime, etime, max, curr, rem, profs, sdate, enddate, loc]
def __init__(self, info):
self.crn = info[0]
Expand Down Expand Up @@ -61,16 +62,17 @@ def addReqs(self, pre, co, raw, desc):
def print(self,):
for attr, value in self.__dict__.items():
print(attr, " : ", value)

def addSchool(self, school):
self.school = school
def __lt__(self, other):
if self.major < other.major:
return (self.major < other.major)
if self.code < other.code:
return self.code < other.code
if self.section < other.section:
return self.section < other.section
if other.stime == "TBA": # TODO: I changed this from time to stime, make sure this is correct
if other.time == "TBA":
return True
if self.stime == "TBA":
return False
return self.stime < other.stime
return self.time < other.time
4 changes: 3 additions & 1 deletion rpi_data/modules/new_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ def getPreCoReqs(semester, subject):
reqs = getReqsInMajor(semester, subject)
return reqs
#Given the info about courses (crn, seats, etc), and prereqs and desc, combine the two into one dataframe
def combineInfo(courses, reqs):
def combineInfo(courses, reqs, school):
print("Combining info")
#A dictionary that stores the courses using major and code as a key, ie "CSCI-1100":[65489,CSCI,1100,01,4.000,...]
comb = []
Expand All @@ -327,6 +327,7 @@ def combineInfo(courses, reqs):
rkey = "?^*"
for course in courses:
c = Course(course)
c.addSchool(school)
if c.short in reqs:
result = reqs[c.short]
prereq = result[result.find(pkey) + len(pkey):result.find(cokey)].strip()
Expand All @@ -336,6 +337,7 @@ def combineInfo(courses, reqs):
c.addReqs(prereq, coreq, raw, desc)
else:
print("error")
sys.exit()
comb.append(c)
comb.sort()
return comb
Expand Down

0 comments on commit 6dc371a

Please sign in to comment.