Skip to content

Commit

Permalink
Rename "todos" in "todo" in mapping for consistency #1524
Browse files Browse the repository at this point in the history
Signed-off-by: tdruez <[email protected]>
  • Loading branch information
tdruez committed Jan 17, 2025
1 parent ec4c163 commit 2c5750d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion scanpipe/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ class ProjectReportForm(forms.Form):
("codebaseresource", "Resources"),
("codebaserelation", "Relations"),
("projectmessage", "Messages"),
("todos", "TODOs"),
("todo", "TODOs"),
],
required=True,
initial="discoveredpackage",
Expand Down
6 changes: 3 additions & 3 deletions scanpipe/pipes/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def get_queryset(project, model_name):
CodebaseRelation.objects.select_related("from_resource", "to_resource")
),
"projectmessage": ProjectMessage.objects.all(),
"todos": CodebaseResource.objects.files().status(flag.REQUIRES_REVIEW),
"todo": CodebaseResource.objects.files().status(flag.REQUIRES_REVIEW),
}

queryset = querysets.get(model_name)
Expand Down Expand Up @@ -309,7 +309,7 @@ def to_json(project):
"codebaseresource": "resource",
"codebaserelation": "relation",
"projectmessage": "message",
"todos": "todo",
"todo": "todo",
}

object_type_to_model_name = {
Expand Down Expand Up @@ -577,7 +577,7 @@ def add_vulnerabilities_sheet(workbook, project):


def add_todos_sheet(workbook, project, exclude_fields):
todos_queryset = get_queryset(project, "todos")
todos_queryset = get_queryset(project, "todo")
if todos_queryset:
queryset_to_xlsx_worksheet(
todos_queryset, workbook, exclude_fields, worksheet_name="TODOS"
Expand Down
2 changes: 1 addition & 1 deletion scanpipe/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def test_scanpipe_views_project_action_report_view(self):
data = {
"action": "report",
"selected_ids": f"{self.project1.uuid}",
"model_name": "todos",
"model_name": "todo",
}
response = self.client.post(url, data=data, follow=True)
self.assertEqual("report.xlsx", response.filename)
Expand Down
2 changes: 1 addition & 1 deletion scanpipe/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1245,7 +1245,7 @@ def get_export_xlsx_prepend_fields(self):
return ["project"]

def get_export_xlsx_worksheet_name(self):
if self.report_form.cleaned_data.get("model_name") == "todos":
if self.report_form.cleaned_data.get("model_name") == "todo":
return "TODOS"

def get_export_xlsx_filename(self):
Expand Down

0 comments on commit 2c5750d

Please sign in to comment.