chore(avscard): fix filtering leading zeroes

This commit is contained in:
Steffen Jost 2023-05-05 15:43:09 +00:00
parent cdf7f5c3b9
commit f617d067f3
2 changed files with 32 additions and 3 deletions

View File

@ -138,7 +138,7 @@ instance {-# OVERLAPS #-} Canonical (Maybe AvsInternalPersonalNo) where
-- where x is an 8 digit AvsCardNo prefixed by zeros, see normalizeAvsCardNo
-- and y is the 1 digit AvsVersionNo
type AvsVersionNo = Text -- always 1 digit
newtype AvsCardNo = AvsCardNo { avsCardNo :: Text } -- always 8 digits
newtype AvsCardNo = AvsCardNo { avsCardNo :: Text } -- always 8 digits -- TODO: Create Smart Constructor
deriving (Eq, Ord, Show, Generic)
deriving newtype (NFData, PathPiece, Csv.ToField, Csv.FromField)
-- No longer needed:
@ -162,7 +162,7 @@ data AvsFullCardNo = AvsFullCardNo { avsFullCardNo :: AvsCardNo, avsFullCardVers
deriving (Eq, Ord, Generic, NFData)
tshowAvsFullCardNo :: AvsFullCardNo -> Text
tshowAvsFullCardNo AvsFullCardNo{..} = avsCardNo avsFullCardNo <> Text.cons '.' avsFullCardVersion
tshowAvsFullCardNo AvsFullCardNo{..} = avsCardNo (canonical avsFullCardNo) <> Text.cons '.' avsFullCardVersion
instance Show AvsFullCardNo where
show = Text.unpack . tshowAvsFullCardNo
@ -170,7 +170,7 @@ instance Show AvsFullCardNo where
readAvsFullCardNo :: Text -> Maybe AvsFullCardNo
readAvsFullCardNo (Text.span Char.isDigit -> (c, Text.uncons -> Just ('.',v)))
| not $ Text.null c, Just (Char.isDigit -> True, "") <- Text.uncons v
= Just $ AvsFullCardNo (AvsCardNo c) v
= Just $ AvsFullCardNo (AvsCardNo $ normalizeAvsCardNo c) v
readAvsFullCardNo _ = Nothing
instance PersistField AvsFullCardNo where

View File

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"$lang$\" xml:lang=\"$lang$\"$if(dir)$ dir=\"$dir$\"$endif$>
<head>
<meta charset=\"utf-8\" />
<meta name=\"generator\" content=\"pandoc\" />
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=yes\" /> $for(author-meta)$
<meta name=\"author\" content=\"$author-meta$\" /> $endfor$ $if(date-meta)$
<meta name=\"dcterms.date\" content=\"$date-meta$\" /> $endif$ $if(keywords)$
<meta name=\"keywords\" content=\"$for(keywords)$$keywords$$sep$, $endfor$\" /> $endif$ <title>
$if(title-prefix)$$title-prefix$ \8211 $endif$$pagetitle$</title>
<style>
$styles.html()$
</style> $for(css)$
<link rel=\"stylesheet\" href=\"$css$\" /> $endfor$ $if(math)$ $math$ $endif$
<!--[if lt IE 9]> <script src=\"//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js\"></script> <![endif]-->
$for(header-includes)$
$header-includes$ $endfor$
</head>
<body> $for(include-before)$ $include-before$ $endfor$ $if(title)$ <header id=\"title-block-header\">
<h1 class=\"title\">$title$</h1> $if(subtitle)$ <p class=\"subtitle\">$subtitle$</p> $endif$ $for(author)$ <p
class=\"author\">$author$</p> $endfor$ $if(date)$ <p class=\"date\">$date$</p> $endif$
</header>
$endif$ $if(toc)$ <nav id=\"$idprefix$TOC\" role=\"doc-toc\"> $if(toc-title)$ <h2 id=\"$idprefix$toc-title\">
$toc-title$</h2> $endif$ $table-of-contents$ </nav>
$endif$ $body$ $for(include-after)$ $include-after$ $endfor$ </body>
</html>