Added an option in the Jira API to treat assigned issues as equivalent to "In Progress".

This commit is contained in:
Jamie Greunbaum 2024-06-09 03:17:08 -04:00
parent 941ea98a35
commit f9bfbc38c8
2 changed files with 16 additions and 7 deletions

View File

@ -17,6 +17,7 @@ const DEFAULT_SEVERITY_FIELD : StringName = &""
const DEFAULT_PLATFORM_FIELD : StringName = &""
const DEFAULT_OS_FIELD : StringName = &""
const DEFAULT_VERSION_FIELD : StringName = &""
const DEFAULT_SHOW_ASSIGNED_AS_IN_PROGRESS : bool = false
const DEFAULT_UNRESOLVED_STATUSES : Array = [&"To Do"]
const DEFAULT_IN_PROGRESS_STATUSES : Array = [&"In Progress"]
@ -65,6 +66,10 @@ func __return_list_of_bugs_thread(map_name:String, callback:Callable) -> void:
"jql": "project=\"%s\" AND type=%s AND (%s) AND \"%s\"~\"%s\" AND \"%s\" is not EMPTY" % [server_data.project_name, bug_issue_type, jql_label_query, map_name_field, map_name, marker_location_field],
"fields": ["summary", "description", "issuetype", "status"]
}
var show_assigned_as_in_progress : bool = ProjectSettings.get_setting("bugbot/reporting/jira/status_labels/show_assigned_as_in_progress", DEFAULT_SHOW_ASSIGNED_AS_IN_PROGRESS)
if show_assigned_as_in_progress: post_data["fields"].append("assignee")
if not server_data.map_name_field_key.is_empty(): post_data["fields"].append(server_data.map_name_field_key)
if not server_data.marker_location_field_key.is_empty(): post_data["fields"].append(server_data.marker_location_field_key)
if not server_data.severity_field_key.is_empty(): post_data["fields"].append(server_data.severity_field_key)
@ -100,7 +105,7 @@ func __return_list_of_bugs_thread(map_name:String, callback:Callable) -> void:
"in_progress_labels": in_progress_labels,
"resolved_labels": resolved_labels,
}
var bug : BugbotBugData = __create_bug_data_from_server_response(issue, map_name, label_dict, server_data, true)
var bug : BugbotBugData = __create_bug_data_from_server_response(issue, map_name, label_dict, server_data, true, show_assigned_as_in_progress)
if bug: bug_array.append(bug)
callback.call_deferred(bug_array)
@ -281,7 +286,7 @@ func __validate_server_response(_response:Variant) -> int:
return Error.FAILED
return Error.OK
func __create_bug_data_from_server_response(bug_in:Dictionary, map_name:String, label_dict:Dictionary, server_data:BugbotJiraServerData, validate_labels:bool) -> BugbotBugData:
func __create_bug_data_from_server_response(bug_in:Dictionary, map_name:String, label_dict:Dictionary, server_data:BugbotJiraServerData, validate_labels:bool, assigned_as_in_progress:bool = DEFAULT_SHOW_ASSIGNED_AS_IN_PROGRESS) -> BugbotBugData:
var bug : BugbotBugData = BugbotBugData.new()
var fields : Dictionary = bug_in["fields"]
@ -311,12 +316,15 @@ func __create_bug_data_from_server_response(bug_in:Dictionary, map_name:String,
var resolved_tag_found : bool = false
var in_progress_tag_found : bool = false
var unresolved_tag_found : bool = false
if (label_dict["resolved_labels"] as Array).has(status_name):
resolved_tag_found = true
if (label_dict["in_progress_labels"] as Array).has(status_name):
if assigned_as_in_progress and fields.has("assignee") and fields["assignee"] != null:
in_progress_tag_found = true
if (label_dict["unresolved_labels"] as Array).has(status_name):
unresolved_tag_found = true
else:
if (label_dict["resolved_labels"] as Array).has(status_name):
resolved_tag_found = true
if (label_dict["in_progress_labels"] as Array).has(status_name):
in_progress_tag_found = true
if (label_dict["unresolved_labels"] as Array).has(status_name):
unresolved_tag_found = true
# Figure out which resolution tag to prioritise, and whether we should show the marker.
var show_marker : bool

View File

@ -89,6 +89,7 @@ func __initialise_project_settings() -> void:
__add_project_setting("bugbot/reporting/jira/status_labels/in_progress_statuses", TYPE_ARRAY, BugbotServerJiraAPI.DEFAULT_IN_PROGRESS_STATUSES, PROPERTY_HINT_ARRAY_TYPE, &"21/:")
__add_project_setting("bugbot/reporting/jira/status_labels/resolved_statuses", TYPE_ARRAY, BugbotServerJiraAPI.DEFAULT_RESOLVED_STATUSES, PROPERTY_HINT_ARRAY_TYPE, &"21/:")
__add_project_setting("bugbot/reporting/jira/status_labels/severity_field", TYPE_STRING, BugbotServerJiraAPI.DEFAULT_SEVERITY_FIELD)
__add_project_setting("bugbot/reporting/jira/status_labels/show_assigned_as_in_progress", TYPE_BOOL, BugbotServerJiraAPI.DEFAULT_SHOW_ASSIGNED_AS_IN_PROGRESS)
__add_project_setting("bugbot/reporting/jira/optional_fields/department_field", TYPE_STRING, BugbotServerJiraAPI.DEFAULT_DEPARTMENT_FIELD)
__add_project_setting("bugbot/reporting/jira/optional_fields/platform_field", TYPE_STRING, BugbotServerJiraAPI.DEFAULT_PLATFORM_FIELD)
__add_project_setting("bugbot/reporting/jira/optional_fields/os_field", TYPE_STRING, BugbotServerJiraAPI.DEFAULT_OS_FIELD)