(project)
Adds relevant issue classes to the given project. Only adds issue classes that were created after the last time
    this function was ran, avoiding re-adding issue classes that the user may have removed from the project.
    :param project: project to add the issue classes to
    :return:
Adds relevant issue classes to the given project. Only adds issue classes that were created after the last time
    this function was ran, avoiding re-adding issue classes that the user may have removed from the project.
    :param project: project to add the issue classes to
    :return:
Adds relevant issue classes to the given project . Only adds issue classes that were created after the last time this function was ran avoiding re - adding issue classes that the user may have removed from the project . : param project : project to add the issue classes to : return :
def add_relevant_issue_classes(project):
    """ Adds relevant issue classes to the given project. Only adds issue classes that were created after the last time
    this function was ran, avoiding re-adding issue classes that the user may have removed from the project.
    :param project: project to add the issue classes to
    :return:
    """
    issue_classes = get_relevant_issue_classes(project)
    logger.info("Adding %d issue_classes to project %s" % (len(issue_classes), project.pk))

    with backend.transaction():
        for issue_class in issue_classes:
            project_issue_class_query = {
                'project': project,
                'issue_class': issue_class
            }
            try:
                backend.get(ProjectIssueClass, project_issue_class_query)
                continue
            except ProjectIssueClass.DoesNotExist:
                project_issue_class = ProjectIssueClass(project_issue_class_query)
                project_issue_class.enabled = True
                backend.save(project_issue_class)

        # re-sync the issue classes associated with the project with the database
        project.revert()
def add_relevant_issue_classes ( project ) : issue_classes = get_relevant_issue_classes ( project ) logger . info ( "Adding %d issue_classes to project %s" % ( len ( issue_classes ) , project . pk ) ) with backend . transaction ( ) : for issue_class in issue_classes : project_issue_class_query = { 'project' : project , 'issue_class' : issue_class } try : backend . get ( ProjectIssueClass , project_issue_class_query ) continue except ProjectIssueClass . DoesNotExist : project_issue_class = ProjectIssueClass ( project_issue_class_query ) project_issue_class . enabled = True backend . save ( project_issue_class ) # re-sync the issue classes associated with the project with the database project . revert ( )