From 947ea4e00f3ec4fbcf2e43df585db83bc037d628 Mon Sep 17 00:00:00 2001 From: Maxime Date: Tue, 7 Mar 2017 17:51:32 +0100 Subject: [PATCH] fix bug in getLastNuGetVersion when result is in JSON. if multiple package hit the searchTerm, the correct one is not always selected. --- src/app/FakeLib/NuGet/NugetVersion.fs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app/FakeLib/NuGet/NugetVersion.fs b/src/app/FakeLib/NuGet/NugetVersion.fs index 56b500b7451..9f00b9307c7 100644 --- a/src/app/FakeLib/NuGet/NugetVersion.fs +++ b/src/app/FakeLib/NuGet/NugetVersion.fs @@ -8,7 +8,8 @@ open System.Xml open System.Xml.Linq type NuGetSearchItemResult = - { Version:string + { Id:string + Version:string Published:DateTime } type NuGetSearchResult = { results:NuGetSearchItemResult list } @@ -59,6 +60,7 @@ let getLastNuGetVersion server (packageName:string) = then let json = JsonConvert.DeserializeObject(text) json.d.results + |> Seq.filter (fun i -> i.Id = packageName) |> Seq.sortByDescending (fun i -> i.Published) |> Seq.tryHead |> fun i ->