- 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

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

View File

@ -94,11 +94,13 @@ func __initialise_project_settings():
func __on_bugbot_menu_item_pressed(id:int):
match id:
BugbotMenuItems.SHOW_BUG_MARKERS:
var scene : String = EditorInterface.get_edited_scene_root().scene_file_path
var scene_root : Node = EditorInterface.get_edited_scene_root()
var scene : String = scene_root.scene_file_path
if not __bugbot_marker_containers.has(scene):
var marker_container : Node3D = Node3D.new()
marker_container.name = "BugMarkerContainer"
__bugbot_marker_containers[scene] = marker_container
scene_root.add_child(marker_container)
__editor_server_api = BugbotServerAPI._create_new_server_api()
__editor_server_api._return_list_of_bugs(__show_bug_markers_response)
BugbotMenuItems.HIDE_BUG_MARKERS:
@ -107,34 +109,25 @@ func __on_bugbot_menu_item_pressed(id:int):
if __bugbot_marker_containers.has(scene_path):
var marker_container : Node3D = __bugbot_marker_containers[scene_path]
BugbotServerAPI._hide_markers(marker_container)
scene_root.remove_child(marker_container)
func __show_bug_markers_response(bug_list:Array) -> void:
var scene_root : Node = EditorInterface.get_edited_scene_root()
var marker_container : Node3D = __bugbot_marker_containers[scene_root.scene_file_path]
scene_root.add_child(marker_container)
for bugbot_data:Resource in bug_list:
if bugbot_data is BugbotBugData:
var bug_status : BugMarker.BugStatus = BugMarker.BugStatus.NEUTRAL
var bug_data : BugbotBugData = bugbot_data as BugbotBugData
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")
if not bug_data.is_open and show_resolved:
if bug_data.resolution == BugbotServerGiteaAPI.RESOLVED_TAG:
bug_status = BugMarker.BugStatus.RESOLVED
else:
if bug_data.resolution == BugbotServerGiteaAPI.RESOLVED_TAG and show_resolved:
bug_status = BugMarker.BugStatus.RESOLVED
elif bug_data.resolution == BugbotServerGiteaAPI.IN_PROGRESS_TAG and show_in_progress:
bug_status = BugMarker.BugStatus.IN_PROGRESS
elif bug_data.resolution == BugbotServerGiteaAPI.UNRESOLVED_TAG and show_unresolved:
bug_status = BugMarker.BugStatus.UNRESOLVED
elif bug_data.resolution == BugbotServerGiteaAPI.IN_PROGRESS_TAG:
bug_status = BugMarker.BugStatus.IN_PROGRESS
elif bug_data.resolution == BugbotServerGiteaAPI.UNRESOLVED_TAG:
bug_status = BugMarker.BugStatus.UNRESOLVED
if bug_status != BugMarker.BugStatus.NEUTRAL:
var bug_marker : BugMarker = load("res://addons/Bugbot/Scenes/bug_marker.tscn").instantiate()
marker_container.add_child(bug_marker)
bug_marker.marker_status = bug_status
bug_marker.bug_data = bugbot_data
var bug_marker : BugMarker = load("res://addons/Bugbot/Scenes/bug_marker.tscn").instantiate()
marker_container.add_child(bug_marker)
bug_marker.marker_status = bug_status
bug_marker.bug_data = bugbot_data
func __add_project_setting(_setting:String, _type:int, _default_value:Variant, _hint:int = PropertyHint.PROPERTY_HINT_NONE, _hint_string:String = ""):