diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2017-11-02 11:36:56 +0100 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2017-11-02 11:36:56 +0100 |
commit | 21efd806a720ed959177f27c3094e5eecc698aac (patch) | |
tree | 5e92654d5e8dbbc689a070d742bb6894265305b0 /src/Db.hs | |
parent | 373a1577306994e15c2f7d279d303ddd2c09bf12 (diff) | |
download | comatose-21efd806a720ed959177f27c3094e5eecc698aac.tar.gz comatose-21efd806a720ed959177f27c3094e5eecc698aac.tar.bz2 comatose-21efd806a720ed959177f27c3094e5eecc698aac.zip |
Add project description
List of features is part of that, feature filtering was moved into the
navbar.
Diffstat (limited to 'src/Db.hs')
-rw-r--r-- | src/Db.hs | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -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 |