Skip to content

Commit

Permalink
(NuGet#9) Fix DownloadCount ordering
Browse files Browse the repository at this point in the history
When Chocolatey is ran with the --order-by-popularity option, the
expectation is that the DownloadCount property is pass within the oData
query.  This is done, however, on further comparison between what is
emitted from Chocolatey 1.x, and the new 2.x version, it was found that
there was a missing follow up ordering, based on the Id.  In addition,
the direction of the order for DownloadCount, should be explicit.  i.e.
rather than adding DownloadCount to the query string, we need to add
DownloadCount%20desc,Id (here %20 is the HTML encoded value for a space
character).

This commit update the orderBy variable to contain the requirement
order by value, when DownloadCount is being applied.
  • Loading branch information
gep13 committed Feb 22, 2023
1 parent 45fcb12 commit 23922b1
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ private string BuildOrderBy(SearchOrderBy? searchOrderBy)
//////////////////////////////////////////////////////////

case SearchOrderBy.DownloadCount:
orderBy = DownloadCountProperty;
orderBy = string.Format("{0}%20desc,{1}", DownloadCountProperty, IdProperty);
break;

//////////////////////////////////////////////////////////
Expand Down

0 comments on commit 23922b1

Please sign in to comment.