def get(self): cc_map = CommonCoreMap.get_all_structured(lightweight=True) # Number of unique [exercise | videos] applying to each grade grade_totals = {} for grade in cc_map: video_set = set([]) exercise_set = set([]) for domain in grade['domains']: for standard in domain['standards']: for exercise in standard['exercises']: exercise_set.add(exercise['display_name']) for video in standard['videos']: video_set.add(video['title']) grade_total = { 'videos': len(video_set), 'exercises': len(exercise_set) } grade_totals[grade['grade']] = grade_total template_values = { 'cc_map': cc_map, 'grade_totals': grade_totals, 'selected_id': 'commoncore' } self.render_jinja2_template('coach_resources/view_map.html', template_values)
def get(self): cc_map = CommonCoreMap.get_all_structured(lightweight=True) # Number of unique [exercise | videos] applying to each grade grade_totals = {} for grade in cc_map: video_set = set([]) exercise_set = set([]) for domain in grade['domains']: for standard in domain['standards']: for exercise in standard['exercises']: exercise_set.add(exercise['display_name']) for video in standard['videos']: video_set.add(video['title']) grade_total = {'videos': len(video_set), 'exercises': len(exercise_set)} grade_totals[grade['grade']] = grade_total template_values = { 'cc_map': cc_map, 'grade_totals': grade_totals, 'selected_id': 'commoncore' } self.render_jinja2_template('coach_resources/view_map.html', template_values)
cc = CommonCoreMap(**data) changed = True for ex in exercises: changed |= bool(cc.update_exercise(ex)) for ex in videos: changed |= bool(cc.update_video(ex)) if changed: cc_list.append(cc) logging.info("Updating %s Common Core Maps", len(cc_list)) db.put(cc_list) logging.info("Busting caches") CommonCoreMap.get_all_structured(lightweight=True, bust_cache=True) CommonCoreMap.get_all_structured(lightweight=False, bust_cache=True) logging.info("Done with CommonCore.") class ManageCommonCore(request_handler.RequestHandler): @user_util.developer_only @ensure_xsrf_cookie def get(self): template_values = { "selected_id": "commoncore", } self.render_jinja2_template("devpanel/uploadcommoncorefile.html", template_values) @user_util.developer_only