- Bugs are now filtered out by status before being passed out of the HTTPClient thread.

- Fixed an issue that caused bugs to be given the incorrect resolution tag.
This commit is contained in:
Jamie Greunbaum
2024-05-22 01:46:51 -04:00
parent 131e944779
commit 5c37903872
2 changed files with 53 additions and 37 deletions
+41 -18
View File
@@ -48,42 +48,65 @@ func __return_list_of_bugs_thread(callback:Callable) -> void:
var response_array : Array
var response_data := JSON.parse_string(response_string)
# If the response is an array, we can make the assumption that this is
# a list of returned bugs.
if response_data is Array:
# If the response is an array, we can make the assumption that this is
# a list of returned bugs.
var resolved_labels : Array = ProjectSettings.get_setting("bugbot/reporting/gitea/status_labels/resolved_statuses")
var in_progress_labels : Array = ProjectSettings.get_setting("bugbot/reporting/gitea/status_labels/in_progress_statuses")
var unresolved_labels : Array = ProjectSettings.get_setting("bugbot/reporting/gitea/status_labels/unresolved_statuses")
var show_resolved : bool = ProjectSettings.get_setting("bugbot/markers/resolved/show_resolved_bugs")
var show_in_progress : bool = ProjectSettings.get_setting("bugbot/markers/in_progress/show_in_progress_bugs")
var show_unresolved : bool = ProjectSettings.get_setting("bugbot/markers/unresolved/show_unresolved_bugs")
for bug_in:Dictionary in response_data:
var bug : BugbotBugData = BugbotBugData.new()
var bug_labels : Array = []
var resolved_tag_found : bool = false
var in_progress_tag_found : bool = false
var unresolved_tag_found : bool = false
# Find which resolution statuses apply to this bug.
bug.is_open = (bug_in["state"] == "open")
if not bug.is_open:
resolved_tag_found = true
else:
for labels:Dictionary in bug_in["labels"]:
bug_labels.append(labels["name"] as String)
for label:String in resolved_labels:
if bug_labels.has(label): resolved_tag_found = true
for label:String in in_progress_labels:
if bug_labels.has(label): in_progress_tag_found = true
for label:String in unresolved_labels:
if bug_labels.has(label): unresolved_tag_found = true
# Figure out which resolution tag to prioritise, and whether we should show the marker.
var show_marker : bool
if resolved_tag_found:
bug.resolution = RESOLVED_TAG
show_marker = show_resolved
elif in_progress_tag_found:
bug.resolution = IN_PROGRESS_TAG
show_marker = show_in_progress
elif unresolved_tag_found or unresolved_labels.is_empty():
bug.resolution = UNRESOLVED_TAG
show_marker = show_unresolved
if not show_marker: continue
bug.id = bug_in["id"]
bug.title = bug_in["title"]
bug.body = bug_in["body"]
bug.component = &"Unused"
bug.platform = &"Unused"
bug.operating_system = &"Unused"
bug.is_open = (bug_in["state"] == "open")
bug.severity = "Severity will go here."
bug.status = bug_in["state"]
bug.duplicate_of = -1
bug.map_name = "Map name will go here."
bug.marker_location = "Marker location will go here."
if not bug.is_open:
bug.resolution = RESOLVED_TAG
else:
for resolution_label:Dictionary in bug_in["labels"]:
var label_name : String = resolution_label["name"]
if resolved_labels.has(label_name):
bug.resolution = RESOLVED_TAG
break
elif in_progress_labels.has(label_name):
bug.resolution = IN_PROGRESS_TAG
break
elif unresolved_labels.has(label_name):
bug.resolution = UNRESOLVED_TAG
break
response_array.append(bug)
elif response_data is Dictionary:
# If the response is a dictionary and not an array, make the assumption