def build_site(): env = j2.Environment(loader=j2.FileSystemLoader('templates/')) skill_template = env.get_template('skills.html') render_skill_type(skill_template, 'tutorial') render_skill_type(skill_template, 'code') render_skill_type(skill_template, 'community') render_skill_type(skill_template, 'docs') with open('docs/_snippets/alunos.md', 'w') as f: for student in sorted(all_students.keys()): student = all_students[student] f.write( f'* [{student.name.title()}](mailto:{student.login}@al.insper.edu.br)\n' ) impacto_template = env.get_template('impact.html') prs = {} issues = {} for student in all_students.values(): for ach in student.achievements: if ach.skill.id in [4, 5]: data = parse_url(ach.metadata) dict_add_to_list(prs, data.project_name, data.url) if ach.skill.id in [20, 21]: data = parse_url(ach.metadata) dict_add_to_list(issues, data.project_name, data.url) with open('docs/_snippets/prs-enviados.md', 'w') as f: f.write(impacto_template.render(data=prs)) with open('docs/_snippets/issues-abertas.md', 'w') as f: f.write(impacto_template.render(data=issues))
def build_site(): env = j2.Environment(loader=j2.FileSystemLoader('templates/')) skill_template = env.get_template('skills.html') render_skill_type(skill_template, 'tutorial') render_skill_type(skill_template, 'code') render_skill_type(skill_template, 'community') render_skill_type(skill_template, 'docs') with open('docs/_snippets/alunos.md', 'w') as f: for student in sorted(all_students.keys()): student = all_students[student] f.write( f'* [{student.name.title()}](mailto:{student.login}@al.insper.edu.br)\n' ) impacto_template = env.get_template('impact.html') info = {} #info = {'projeto': {'Pull Requests': [],'issues': []}} for student in all_students.values(): for ach in student.achievements: if ach.skill.id in [4, 5] and ach.user == student: if isinstance(ach.metadata, dict): url = ach.metadata['url'] else: url = ach.metadata print(url) data = parse_url(url) dict_add_to_dict(info, data.project_name, 'Pull Requests', data) if ach.skill.id in [20, 21] and ach.user == student: if isinstance(ach.metadata, dict): url = ach.metadata['url'] else: url = ach.metadata data = parse_url(url) dict_add_to_dict(info, data.project_name, 'Issues', data) with open('docs/_snippets/impacto.md', 'w') as f: f.write(impacto_template.render(data=info))
def list_users(): for st in all_students.values(): k = '*' if st.has_key else '' print(f'{st.name}{k}')
def build_site(): env = j2.Environment(loader=j2.FileSystemLoader('templates/')) render_skill_type('tutorial') render_skill_type('code') render_skill_type('community') render_skill_type('docs') students = [] for st_login in sorted(all_students.keys()): st = all_students[st_login] students.append([ f'![{st.name}]({st.avatar}){{: style="max-width:64px; valign="center"}}', st.name.title(), f'[![](css/github.png)](http://github.com/{st.ghuser})' ]) with open('docs/_snippets/alunos.md', 'w') as f: f.write(tabulate.tabulate(students, headers=('', '', ''), tablefmt='pipe')) impacto_template = env.get_template('impacto.html') info = {} info_insper = [] eventos = set() num_eventos = 0 num_aceitos = 0 for student in all_students.values(): for ach in student.all_achievements: if ach.skill.id == 10 and ach.user == student: info_insper.append(ach) if ach.skill.id == 40 and ach.user == student: num_eventos += 1 if 'picture' in ach.metadata: eventos.add((ach.metadata['picture'], ach.metadata.get('url', '#'))) if ach.skill.id == 22 and ach.user == student: num_aceitos += 1 # Skill Minha primeira contribuiĆ§Ć£o if ach.skill.id == 3 and ach.user == student: if isinstance(ach.metadata, dict): url = ach.metadata['url'] else: url = ach.metadata data = parse_url(url) dict_add_to_dict(info, data.project_name, 'Pull Requests', data) if ach.skill.id in [20, 21] and ach.user == student: if isinstance(ach.metadata, dict): url = ach.metadata['url'] else: url = ach.metadata data = parse_url(url) dict_add_to_dict(info, data.project_name, 'Issues', data) with open('docs/impacto.md', 'w') as f: num_projetos = len(info) num_prs = 0 for proj in info: prs_proj = info[proj].get('Pull Requests', []) num_prs += len(prs_proj) sorted_keys = sorted(info.keys(), key=lambda t: -len(info[t].get('Pull Requests', []))) f.write(impacto_template.render(data=info, info_insper=info_insper, eventos=eventos, num_eventos=num_eventos, sorted_keys=sorted_keys, num_projetos=num_projetos, num_prs=num_prs, num_aceitos=num_aceitos))