fix assignable version order

pull/8083/head
ulferts 5 years ago
parent 9c99bc213f
commit 0258e04223
No known key found for this signature in database
GPG Key ID: A205708DE1284017
  1. 2
      app/models/project.rb
  2. 4
      spec/requests/api/v3/work_packages/form/work_package_form_resource_spec.rb

@ -306,7 +306,7 @@ class Project < ActiveRecord::Base
# reduce the number of db queries when performing operations including the
# project's versions.
def assignable_versions
@all_shared_versions ||= shared_versions.with_status_open.to_a
@all_shared_versions ||= shared_versions.with_status_open.order_by_newest_date.to_a
end
# Returns a hash of project users grouped by role

@ -517,8 +517,8 @@ describe 'API v3 Work package form resource', type: :request, with_mail: false d
describe 'version' do
let(:path) { '_embedded/payload/_links/version/href' }
let(:target_version) { FactoryBot.create(:version, project: project, name: 'zzzz') }
let(:other_version) { FactoryBot.create(:version, project: project, name: 'aaaa') }
let(:target_version) { FactoryBot.create(:version, project: project, start_date: Date.today - 2.days) }
let(:other_version) { FactoryBot.create(:version, project: project, start_date: Date.today - 1.day) }
let(:version_link) { api_v3_paths.version target_version.id }
let(:version_parameter) { { _links: { version: { href: version_link } } } }
let(:params) { valid_params.merge(version_parameter) }

Loading…
Cancel
Save