From 21efd806a720ed959177f27c3094e5eecc698aac Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Thu, 2 Nov 2017 11:36:56 +0100 Subject: Add project description List of features is part of that, feature filtering was moved into the navbar. --- src/Db.hs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/Db.hs') diff --git a/src/Db.hs b/src/Db.hs index 8f6fdba..fa38db3 100644 --- a/src/Db.hs +++ b/src/Db.hs @@ -4,6 +4,7 @@ module Db where import System.FilePath ((<.>), splitExtension) import Data.List (nub, sort, sortBy, isPrefixOf) import Control.Monad +import Data.Maybe (catMaybes) import Data.Yaml import Text.Parsec.Error import Text.ParserCombinators.Parsec.Prim @@ -92,6 +93,15 @@ getFeaturesByLevel db level = M.filterWithKey (\k v -> countDots k == level) $ d -- |Get features by `base` feature getFeaturesByBase db base = M.filterWithKey (\k v -> (base ++ ".") `isPrefixOf` k) $ dfeatures db +-- |Get number of algorithms in database +algorithmCount db = M.size $ dalgos db + +minMaxPublicationYears db = (firstyear, lastyear) + where + pubyears = catMaybes $ map (lookup "year" . E.fields) $ dpublications db + firstyear = foldr min (head pubyears) (tail pubyears) + lastyear = foldr max (head pubyears) (tail pubyears) + -- |Read protocol and bib database from file readDb :: String -> IO Database readDb f = do -- cgit v1.2.3