# Feature OP-3156 - Sort versions in the roadmap/versions index by start date

Project: OpenProject
Status: new
URL: https://community.openproject.org/work_packages/OP-3156

## Planning

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Target versions | Wish List |
| Sprint |  |
| Backlog bucket |  |
| Votes | 3 |
| List |  |
| Roadmap |  |
| Relevance |  |

## OPEN POINTS / FEEDBACK

_No work packages_

## Features and Chunks

_No work packages_

## Bugs and other work packages

_No work packages_

## Technical Details

| Attribute | Value |
| --- | --- |
| Module |  |
| Feature Flag |  |
| Requires doc change | No |
| Enterprise plan |  |

## Details

| Attribute | Value |
| --- | --- |
| Pull preview |  |
| Mockups |  |
| Accessibility | No |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable |  |
| Product manager |  |
| Feature Lead |  |
| Developers |  |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Estimates and progress

| Attribute | Value |
| --- | --- |
| PD (min) |  |
| PD (max) |  |
| Work |  |
| Labor costs |  |

## Description

Currently, all versions are sorted based on their name rather than their assigned start date.  
It would be nice to sort them by their assigned start date and if that fails, e.g. start date is nil, order them so that they come last, falling back to the original sorting strategy.

Again, the fix is rather simple in app/controllers/version\_controllers.rb

    48: @versions = @versions.uniq.sort! { |x, y| x.start_date == nil ? ( y.start_date == nil ? x <=> y : 1 ) : ( y.start_date == nil ? -1 : ( x.start_date < y.start_date ? -1 : ( x.start_date > y.start_date ? 1 : 0 ) ) ) }
