Skip to content

Commit

Permalink
Fix #218: Sort versions on Scrum Board by date order descending
Browse files Browse the repository at this point in the history
  • Loading branch information
rombert committed Sep 13, 2011
1 parent df9328c commit 9afe4ca
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Scrum/pages/board.php
Expand Up @@ -12,17 +12,20 @@
$resolved_threshold = config_get("bug_resolved_status_threshold");

$bug_table = db_get_table("mantis_bug_table");
$version_table = db_get_table("mantis_project_version_table");


# Fetch list of target versions in use for the given projects
$query = "SELECT DISTINCT target_version FROM {$bug_table} WHERE project_id IN (" . join(", ", $project_ids) . ") ORDER BY target_version DESC";
$query = "SELECT DISTINCT v.version FROM {$version_table} v JOIN {$bug_table} b ON b.target_version= v.version WHERE v.project_id IN (".join(", ", $project_ids). ") ORDER BY v.date_order DESC";

$result = db_query_bound($query);

$versions = array();
while ($row = db_fetch_array($result))
{
if ($row["target_version"])
if ($row["version"])
{
$versions[] = $row["target_version"];
$versions[] = $row["version"];
}
}

Expand Down

3 comments on commit 9afe4ca

@amyreese
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rombert this commit seems to break on certain DB's. I received an email from a user who got the following error when using the plugin:

Database query failed. Error received from database was #-1: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list at character 154 for the query: SELECT DISTINCT v.version FROM mantis_project_version_table v JOIN mantis_bug_table b ON b.target_version= v.version WHERE v.project_id IN (16) ORDER BY v.date_order DESC.

@rombert
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll look into it in the coming days.

@rombert
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be fixed with 051497e

Please sign in to comment.