Skip to content

Commit

Permalink
don't order absent versions, start date and due date to the end in bo…
Browse files Browse the repository at this point in the history
…th directions
  • Loading branch information
toy committed Oct 28, 2024
1 parent 223fd69 commit 98be9c9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
7 changes: 2 additions & 5 deletions app/models/queries/work_packages/selects/property_select.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,17 +97,14 @@ def caption
association: "version",
sortable: "name",
default_order: "ASC",
null_handling: "NULLS LAST",
groupable: "#{WorkPackage.table_name}.version_id"
},
start_date: {
sortable: "#{WorkPackage.table_name}.start_date",
null_handling: "NULLS LAST"
sortable: "#{WorkPackage.table_name}.start_date"
},
due_date: {
highlightable: true,
sortable: "#{WorkPackage.table_name}.due_date",
null_handling: "NULLS LAST"
sortable: "#{WorkPackage.table_name}.due_date"
},
estimated_hours: {
sortable: "#{WorkPackage.table_name}.estimated_hours",
Expand Down
2 changes: 1 addition & 1 deletion spec/models/query/results_version_integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
end
end
let(:work_packages_asc) { [old_version_wp, no_date_version_wp, new_version_wp, no_version_wp] }
let(:work_packages_desc) { [new_version_wp, no_date_version_wp, old_version_wp, no_version_wp] }
let(:work_packages_desc) { [no_version_wp, new_version_wp, no_date_version_wp, old_version_wp] }

before do
login_as(user)
Expand Down
10 changes: 5 additions & 5 deletions spec/models/query/sort_criteria_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@

it "adds the order handling (and the default order by id)" do
expect(subject)
.to eq [["work_packages.start_date NULLS LAST"], ["work_packages.id DESC"]]
.to eq [["work_packages.start_date"], ["work_packages.id DESC"]]
end
end

Expand All @@ -96,7 +96,7 @@

it "adds the order handling (and the default order by id)" do
expect(subject)
.to eq [["work_packages.start_date NULLS LAST"], ["work_packages.id DESC"]]
.to eq [["work_packages.start_date"], ["work_packages.id DESC"]]
end
end

Expand All @@ -105,7 +105,7 @@

it "adds the order handling (and the default order by id)" do
expect(subject)
.to eq [["work_packages.start_date DESC NULLS LAST"], ["work_packages.id DESC"]]
.to eq [["work_packages.start_date DESC"], ["work_packages.id DESC"]]
end
end

Expand All @@ -114,8 +114,8 @@

it "adds the order handling (and the default order by id)" do
expect(subject)
.to eq [["name DESC NULLS LAST"],
["work_packages.start_date NULLS LAST"],
.to eq [["name DESC"],
["work_packages.start_date"],
["work_packages.id DESC"]]
end
end
Expand Down

0 comments on commit 98be9c9

Please sign in to comment.