Patch #16116

Sort of version options

Added by Daniel Felix almost 8 years ago. Updated almost 8 years ago.

Status:Needs feedbackStart date:
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:

0%

Category:Roadmap
Target version:-

Description

Hi there,

currently all versions are just sorted by an array.

This causes that our version field results in an unsorted order. Either id nor name or date (all dates are nil) is respected.

This way could improve the version sort.

See source:trunk/app/models/issue.rb#L743

Replace this line with

@assignable_versions = versions.uniq.sort_by{|v| [v.effective_date, v.name]}

This will sort the result in first place by effective date and otherwise by name.

Any regressions?

Best regards,
Daniel

History

#1 Updated by Jean-Philippe Lang almost 8 years ago

  • Status changed from New to Needs feedback
  • Assignee set to Jean-Philippe Lang

Daniel Felix wrote:

See source:trunk/app/models/issue.rb#L743

I don't get it, @assignable_versions = versions.uniq.sort should already sort versions by date and name because of Version#<=> defintion (see source:/tags/2.5.0/app/models/version.rb#L181). Doesn't work?

#2 Updated by Daniel Felix almost 8 years ago

Hi Jean-Philippe,

the point is, that uniq.sort distincs every version and sort the version by it's effective date and in the second point by the ID itself.

In this way, the versions are sorted by the effective date and in the second case (same date or no date) by the name.

Best regards,
Daniel

Also available in: Atom PDF