Skip to content

Commit

Permalink
Merge pull request #42 from skystrife/bugfix-is_ta
Browse files Browse the repository at this point in the history
fix(dev): repair is_ta boolean in get_user_classes
hfaran authored Sep 6, 2018
2 parents cbb46df + 5deffec commit 0976a43
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions piazza_api/piazza.py
Original file line number Diff line number Diff line change
@@ -74,14 +74,16 @@ def get_user_classes(self):
# raw_classes = self.get_user_profile().get('all_classes').values()

# Get classes from the user status (includes all classes)
raw_classes = self.get_user_status().get('networks', [])
status = self.get_user_status()
uid = status['id']
raw_classes = status.get('networks', [])

classes = []
for rawc in raw_classes:
c = {k: rawc[k] for k in ['name', 'term']}
c['num'] = rawc.get('course_number', '')
c['nid'] = rawc['id']
c['is_ta'] = rawc.get('is_ta', False)
c['is_ta'] = uid in rawc['prof_hash']
classes.append(c)

return classes

0 comments on commit 0976a43

Please sign in to comment.