def get_resolution_history()

in bugbot/rules/perfalert_resolved_regression.py [0:0]


    def get_resolution_history(self, bug):
        bug_info = {}

        # Get the last resolution change that was made in this bug
        for change in bug["history"][::-1]:
            # Get the most recent resolution change first, this is because
            # it could have changed since the status was changed and by who
            if not bug_info.get("resolution"):
                for specific_change in change["changes"]:
                    if specific_change["field_name"] == "resolution":
                        bug_info["resolution"] = specific_change["added"]
                        bug_info["resolution_previous"] = (
                            specific_change["removed"].strip() or "---"
                        )
                        bug_info["resolution_time"] = change["when"]
                        break

            if bug_info.get("resolution"):
                # Find the status that the bug was resolved to, and by who
                for specific_change in change["changes"]:
                    if specific_change["field_name"] == "status" and specific_change[
                        "added"
                    ] in ("RESOLVED", "REOPENED"):
                        bug_info["status"] = specific_change["added"]
                        bug_info["status_author"] = change["who"]
                        bug_info["status_time"] = change["when"]
                        break

            if bug_info.get("status"):
                break

        return bug_info