Commit 6b41855d authored by ViolanteCodes's avatar ViolanteCodes
Browse files

added two functions in the get_context_data that set two flags,...

added two functions in the get_context_data that set two flags, open_issues_flag and closed_issues_flag. This is now used by the project_detail.html template to determine if the "there are no open issues" / "there are no closed issues" blocks should be populated.
parent 84587d42
Loading
Loading
Loading
Loading
+17 −1
Original line number Diff line number Diff line
@@ -313,8 +313,24 @@ class ProjectDetailView(DetailView):
        context['gitlab_project'] = gitlab_project.attributes
        issues_list = gitlab_project.issues.list()
        context['issues_list'] = issues_list
        context['open_issues_flag'] = self.check_if_open_issues(issues_list)
        context['closed_issues_flag'] = self.check_if_closed_issues(issues_list)
        return context

    def check_if_open_issues(self, issues_list):
        open_issues = False
        for issue in issues_list:
            if issue.state == 'opened':
                open_issues = True
        return open_issues
    
    def check_if_closed_issues(self, issues_list):
        closed_issues = False
        for issue in issues_list:
            if issue.state == 'closed':
                closed_issues = True
        return closed_issues
    
# -------------------------ISSUE VIEWS----------------------------------
# Views related to creating/looking up issues.
# ----------------------------------------------------------------------