mozilla / bugzy

A bugzilla client for the Activity Stream Team
https://www.bugzy.org
10 stars 13 forks source link

Add a Jira Tickets view #271

Closed aminomancer closed 1 year ago

aminomancer commented 1 year ago

Related to #270. This view should basically start by querying all the unresolved bugs in our components that have a "See Also" field whose value contains the substring mozilla-hub.atlassian.net/browse/OMC, and have an iteration whose first part (e.g. the 117 in 117.1) matches the current iteration. Then it should loop over each of the returned bugs to organize them by ticket, then make a BugList for each ticket.

let tickets = {};
for (let bug of bugs) {
  let ticket = bug.seeAlso.value.match(
    /mozilla-hub.atlassian.net\/browse\/(OMC-\d+)/
  );
  if (ticket) {
    tickets[ticket[1]] = tickets[ticket[1]] || [];
    tickets[ticket[1]].push(bug);
  }
}

let lists = [];
for (let ticket in tickets) {
  lists.push(
    <BugList
      bugs={tickets[ticket]}
      title={
        <a href={`https://mozilla-hub.atlassian.net/browse/${ticket}`}>
          {ticket}
        </a>
      }
    />
  );
}

And each BugList should look basically like this, sorted by points, then by priority.

[OMC-123]()

[check all] 3 bugs \ 13 points
Bug Title Assignee Iteration Priority Points
[ ] [1234 567]() Lorem ipsum yozhang 118.1 P2 7
[ ] [2345 678]() 📋 dolor sit amet shughes 118.1 P1 3
[ ] [3456 789]() consectetur pdahiya 118.1 P1 3

The BugLists themselves should be sorted by total points. So I think you could basically do

lists.sort((a, b) => {
  return (
    b.props.bugs.reduce((acc, bug) => acc + bug.points.value, 0) -
    a.props.bugs.reduce((acc, bug) => acc + bug.points.value, 0)
  );
});