Moved function for obtaining all extension IDs from the data base into the SqlConnector.

This commit is contained in:
Achim D. Brucker 2017-08-13 14:08:57 +01:00
parent 658364fc54
commit 14cf5c4ad6
2 changed files with 19 additions and 19 deletions

View File

@ -63,4 +63,13 @@ module SqlConnector =
} |> Seq.filter (fun (date, download) -> date.IsSome && download.IsSome)
|> Seq.map (fun (date, download) -> (System.DateTime.Parse(date.Value),
download.Value))
|> Seq.toArray
|> Seq.toArray
let getAllExtIds (ctx:ExtensionDbType) =
query {
for ext in ctx.Main.Extension do
select ext.Extid
} |> Seq.distinct
|> Seq.choose id
|> Seq.toList

View File

@ -20,6 +20,10 @@
#I "../../packages/FSharp.Data/lib/net40"
#r "FSharp.Data.dll"
#load "../../packages/FsLab/Themes/DefaultWhite.fsx"
#load "../../packages/FsLab/FsLab.fsx"
open Deedle
open FSharp.Data
open XPlot.GoogleCharts
@ -29,28 +33,15 @@ open XPlot.GoogleCharts.Deedle
#r "LogicalHacking.ExtensionDsLab.dll"
open LogicalHacking.ExtensionDsLab.Archive.SqlConnector
#load "../../packages/FsLab/Themes/DefaultWhite.fsx"
#load "../../packages/FsLab/FsLab.fsx"
let ctx = getCtx None Auto
let chartDownloads extIds = (List.map (fun e -> (series (getDownloads ctx e))) extIds)
|> Chart.Line
|> Chart.WithOptions (Options(legend=Legend(position="bottom")))
|> Chart.WithLabels extIds
let exts =
ctx.Main.Extension
|> Seq.map(fun c -> c.Extid)
|> Seq.distinct
|> Seq.toList
let ExtIds = ["aaagbdompnfgjaokopkpaceijcapjdde"
"aaahoedfmconkhncmkajlkallgnkjibh"
"aaahpjmadckbgmdbflcgblcnimbpfefg"
"aaaidlpoefeeklbhpndokmfipimojimj"
"aaaikdbhdiebhdogngakgnmjgpkpcmln"
]
let x = (List.map (fun e -> (series (getDownloads ctx e))) ExtIds)
|> Chart.Line
|> Chart.WithOptions (Options(legend=Legend(position="bottom")))
|> Chart.WithLabels ExtIds
chartDownloads (List.take 5 (getAllExtIds ctx))
let extData =
query {for x in ctx.Main.Extension do