Skip to content

Adds sort order by created_at to Work Item Hierarchy Widget

What does this MR do and why?

Adds sort order by created_at to Work Item Hierarchy Widget

Child entries in the Work Items Hierarchy Widget GraphQL API response should be sorted by creation date. Ref: #367525 (closed)

DB query details

Note: we have a limitation for max children defined and there should not be more than 100.

SELECT
    "issues".*
FROM
    "issues"
    INNER JOIN "work_item_parent_links" ON "issues"."id" = "work_item_parent_links"."work_item_id"
WHERE
    "work_item_parent_links"."work_item_parent_id" = 115219866
ORDER BY
    "issues"."created_at" ASC

Query plan (internal): https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/14433/commands/50743

Screenshots or screen recordings

Screenshot_2023-01-11_at_13.46.05

How to set up and validate locally

1. Local Test scenario background setup.

  • Create a new Issue:
    • Add five tasks to the issue named Task #1, Task #2 ... Task #5.
      • Verify new tasks are added to the end of the list, which is consistent behavior.
      • Reload the page in the browser, and verify Task #1 appears at the top of the list.
  • In the local GDK rails console, executed the snippet
middle_item = WorkItem.where(title: "Task #3").last
middle_item.created_at = 10.minutes.ago
middle_item.save

2. Local Test scenario verification.

  • Reloaded issue page in the browser and verified:
    • All five tasks are present on the page.
    • Task #3 appears at the top of the list.
    • All other than Task #3 work items are present on the page and the order is consistent.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #367525 (closed)

Edited by Petro Koriakin

Merge request reports