def update(self): for student in self.students: if student['needs_update']==True: # create StudentProject for student that needs update full_name = student['name'].strip('CENTREVILLE:').strip(' ').split(', ') first = full_name[1] last = full_name[0] pks_to_complete = [(pk[0],pk[3],pk[4]) for pk in student['updates_to_apply']['completed']] if len(pks_to_complete) > 0: project = StudentProject(last,first,self.username,self.pwd) print 'Updating ' + student['name'] + ' - (completing ' + str(len(pks_to_complete)) + ' todos)' for pk in pks_to_complete: status = project.complete_todo('Learning Plan Prescriptives',pk[0],pk[1],pk[2]) else: print 'Nothing to update for ' + student['name']
print('\n') account_id = 2650701 uname = '*****@*****.**' # create Basecamp object with student project details bc = Basecamp(account_id,uname,pwd) # read learning plans & current enrollment detail from SF reports lp_report = ReportReader('../data/lp_report.csv') enrollment_list = Enrollment('../data/enrollment.csv') proj_name = 'NEW: Venkatesh, Varsha' #response = bc.create_template_project('StudentTemplate',proj_name, 'A place to plan, execute, and discuss a students\' progress with all stakeholders') s = StudentProject('Venkatesh','Varsha',uname,pwd) lp = lp_report.students['Varsha Venkatesh'] for pk in lp['completed']: s.complete_todo('Learning Plan Prescriptives',pk[0],pk[3],pk[4]) # Determine which projects need updating and set "needs update" key value to True # return a list of names of projects that need to be created #new_projects = bc.find_updates(enrollment_list, lp_report) # for proj in new_projects: # proj_name = 'NEW: ' + proj.split(' ')[1] + ', ' + proj.split(' ')[0] # print proj_name # response = bc.create_template_project('StudentTemplate',proj_name, 'A place to plan, execute, and discuss a students\' progress with all stakeholders') #status = bc.update()