calpoly-csai / api

Official API for the NIMBUS Voice Assistant accessible via HTTP REST protocol.
https://nimbus.api.calpolycsai.com/
GNU General Public License v3.0
9 stars 4 forks source link

create "get_courses_professor_teaches" function in database_wrapper.py #21

Open danield2255 opened 4 years ago

danield2255 commented 4 years ago

@mfekadu

Objective

have a function to get a list of the courses which a professor teaches

Key Result

Commit code to implement the "get_courses_professor_teaches" function

Details

Need to link the Professor and Courses tables first

mfekadu commented 4 years ago

I think @cameron-toy is working on the #51 which contains data (see https://github.com/calpoly-csai/api/issues/51#issuecomment-590116592) for

  1. the Professor's name and
  2. the course information in the string formatted as courseDept courseNum_section

@danield2255 could we resolve this issue by the following function call?

>>> db = NimbusMySQLAlchemy()
>>> db.get_property_from_entity(
        prop="course",
        entity=Entity.Schedules.Schedules,
        entity_string="Khosmood",
    )
>>> ["CSC 582_01", "CSC 101_01", "CSC 101_02", "CSC 453_03"]

reference code for function...

https://github.com/calpoly-csai/api/blob/9f76075cc298dc6f668d2afb8cd1f69b18f9dce2/database_wrapper.py#L346-L388