Пример #1
0
    def create_student_projects(self,
                                csv,
                                project_part,
                                icon="policy",
                                color="red"):
        """
        create_project creates projects in Phabricator from a csv.
        :param groups: A unique list of projects.
        :param icon: String of phab icon name.
        :param color: String of phab color.
        :return: None
        """
        groups = load_group_membership.unique_groups(csv)
        for group_code in groups:
            group_name = group_translator.get_project_name_from_group_code(
                group_code=group_code,
                project_part=project_part,
                is_marking_group=False)
            if group_name:
                usernames = load_group_membership.users_for_group(
                    csv, group_code)
                phids = []
                for u in usernames:
                    phids.append(phab_user.get_phid_from_username(u))
                phids = phids + PHAB_SUPER_USER_PHIDS

                phab_project.create(group_name, icon, color, phids)
                print("Created group: %s" % (group_name, ))
            else:
                print("Skipped: %s" % (group_code, ))
Пример #2
0
    def create_student_projects(self, csv, project_part, icon="policy", color="red"):
        """
        create_project creates projects in Phabricator from a csv.
        :param groups: A unique list of projects.
        :param icon: String of phab icon name.
        :param color: String of phab color.
        :return: None
        """
        groups = load_group_membership.unique_groups(csv)
        for group_code in groups:
            group_name = group_translator.get_project_name_from_group_code(
                group_code=group_code,
                project_part=project_part,
                is_marking_group=False
            )
            if group_name:
                usernames = load_group_membership.users_for_group(csv, group_code)
                phids = []
                for u in usernames:
                    phids.append(phab_user.get_phid_from_username(u))
                phids = phids + PHAB_SUPER_USER_PHIDS

                phab_project.create(group_name, icon, color, phids)
                print("Created group: %s" % (group_name,))
            else:
                print("Skipped: %s" % (group_code,))
Пример #3
0
    def create_marking_projects(self,
                                students_csv,
                                markers_csv,
                                project_part,
                                icon="policy",
                                color="red"):
        """
        create_project creates projects in Phabricator from a csv.
        :param groups: A unique list of projects.
        :param icon: String of phab icon name.
        :param color: String of phab color.
        :return: None
        """
        all_group_codes = load_group_membership.unique_groups(students_csv)
        all_tutors = load_group_membership.usernames(markers_csv)
        allocations = self.get_random_tutor_marking_allocations(
            all_tutors, all_group_codes)

        for tutor, group_codes in allocations.iteritems():
            print("Tutor %s is marking groups: %s" % (tutor, group_codes)
                  )  # this is in a separate loop to make it print cleanly

        for tutor, group_codes in allocations.iteritems():
            tutor_phid = phab_user.get_phid_from_username(tutor)
            for group_code in group_codes:
                group_name = group_translator.get_project_name_from_group_code(
                    group_code=group_code,
                    project_part=project_part,
                    is_marking_group=True)
                phab_project.create(group_name, icon, color,
                                    [tutor_phid] + PHAB_SUPER_USER_PHIDS)
                print("Created group: %s" % (group_name, ))
Пример #4
0
    def create_marking_projects(self, students_csv, markers_csv, project_part, icon="policy", color="red"):
        """
        create_project creates projects in Phabricator from a csv.
        :param groups: A unique list of projects.
        :param icon: String of phab icon name.
        :param color: String of phab color.
        :return: None
        """
        all_group_codes = load_group_membership.unique_groups(students_csv)
        all_tutors = load_group_membership.usernames(markers_csv)
        allocations = self.get_random_tutor_marking_allocations(all_tutors, all_group_codes)

        for tutor, group_codes in allocations.iteritems():
            print("Tutor %s is marking groups: %s" % (tutor, group_codes)) # this is in a separate loop to make it print cleanly

        for tutor, group_codes in allocations.iteritems():
            tutor_phid = phab_user.get_phid_from_username(tutor)
            for group_code in group_codes:
                group_name = group_translator.get_project_name_from_group_code(
                    group_code=group_code,
                    project_part=project_part,
                    is_marking_group=True
                )
                phab_project.create(group_name, icon, color, [tutor_phid] + PHAB_SUPER_USER_PHIDS)
                print("Created group: %s" % (group_name,))