Commit 1b8cf260 authored by Jonas Waeber's avatar Jonas Waeber
Browse files

Fix date facet structure.

parent ecc6197e
Pipeline #12256 passed with stages
in 5 minutes and 30 seconds
...@@ -34,7 +34,7 @@ object DateFacetBuilder { ...@@ -34,7 +34,7 @@ object DateFacetBuilder {
return listOf( return listOf(
"$level_1$separator$century$separator", "$level_1$separator$century$separator",
"$level_2$separator$century$separator$decade$terminator" "$level_2$separator$century$separator$decade$separator$terminator"
) )
} }
...@@ -56,7 +56,7 @@ object DateFacetBuilder { ...@@ -56,7 +56,7 @@ object DateFacetBuilder {
val decade = getDecade(from) val decade = getDecade(from)
listOf( listOf(
"$level_1$separator$century$separator", "$level_1$separator$century$separator",
"$level_2$separator$century$separator$decade$terminator" "$level_2$separator$century$separator$decade$separator$terminator"
) )
} else { } else {
val fromCentury = getCentury(from) val fromCentury = getCentury(from)
...@@ -68,12 +68,12 @@ object DateFacetBuilder { ...@@ -68,12 +68,12 @@ object DateFacetBuilder {
if (fromCentury == untilCentury && fromDecade == untilDecade) { if (fromCentury == untilCentury && fromDecade == untilDecade) {
listOf( listOf(
"$level_1$separator$fromCentury$separator", "$level_1$separator$fromCentury$separator",
"$level_2$separator$fromCentury$separator$fromDecade$terminator" "$level_2$separator$fromCentury$separator$fromDecade$separator$terminator"
) )
} else if (fromCentury == untilCentury && fromDecade != untilDecade) { } else if (fromCentury == untilCentury && fromDecade != untilDecade) {
val results = mutableListOf( val results = mutableListOf(
"$level_1$separator$fromCentury$separator", "$level_1$separator$fromCentury$separator",
"$level_2$separator$fromCentury$separator$fromDecade$terminator" "$level_2$separator$fromCentury$separator$fromDecade$separator$terminator"
) )
var fromDecadeAsInt = fromDecade.substring(0, 4).toInt() var fromDecadeAsInt = fromDecade.substring(0, 4).toInt()
val untilDecadeAsInt = untilDecade.substring(0, 4).toInt() val untilDecadeAsInt = untilDecade.substring(0, 4).toInt()
...@@ -83,7 +83,7 @@ object DateFacetBuilder { ...@@ -83,7 +83,7 @@ object DateFacetBuilder {
results.add( results.add(
"$level_2$separator$fromCentury$separator${getDecade( "$level_2$separator$fromCentury$separator${getDecade(
fromDecadeAsInt fromDecadeAsInt
)}$terminator" )}$separator$terminator"
) )
} }
results results
...@@ -103,7 +103,7 @@ object DateFacetBuilder { ...@@ -103,7 +103,7 @@ object DateFacetBuilder {
fromCenturyAsInt += 1 fromCenturyAsInt += 1
} }
results.add( results.add(
"$level_2$separator$fromCentury$separator$fromDecade$terminator" "$level_2$separator$fromCentury$separator$fromDecade$separator$terminator"
) )
var fromDecadeAsInt = fromDecade.substring(0, 4).toInt() var fromDecadeAsInt = fromDecade.substring(0, 4).toInt()
val untilDecadeAsInt = untilDecade.substring(0, 4).toInt() val untilDecadeAsInt = untilDecade.substring(0, 4).toInt()
...@@ -115,7 +115,7 @@ object DateFacetBuilder { ...@@ -115,7 +115,7 @@ object DateFacetBuilder {
fromDecadeAsInt / 100 fromDecadeAsInt / 100
)}$separator${getDecade( )}$separator${getDecade(
fromDecadeAsInt fromDecadeAsInt
)}$terminator" )}$separator$terminator"
) )
} }
results results
......
...@@ -60,47 +60,47 @@ class Test { ...@@ -60,47 +60,47 @@ class Test {
TestDate( TestDate(
"1921-09-14", "1921-09-14",
"single", "single",
listOf("0~20.Jahrhundert~", "1~20.Jahrhundert~1921-1930#") listOf("0~20.Jahrhundert~", "1~20.Jahrhundert~1921-1930~#")
), ),
TestDate( TestDate(
"1921", "1921",
"range", "range",
listOf("0~20.Jahrhundert~", "1~20.Jahrhundert~1921-1930#") listOf("0~20.Jahrhundert~", "1~20.Jahrhundert~1921-1930~#")
), ),
TestDate( TestDate(
"1921/1922", "1921/1922",
"range", "range",
listOf("0~20.Jahrhundert~", "1~20.Jahrhundert~1921-1930#") listOf("0~20.Jahrhundert~", "1~20.Jahrhundert~1921-1930~#")
), ),
TestDate( TestDate(
"1921-05-01/02", "1921-05-01/02",
"range", "range",
listOf("0~20.Jahrhundert~", "1~20.Jahrhundert~1921-1930#") listOf("0~20.Jahrhundert~", "1~20.Jahrhundert~1921-1930~#")
), ),
TestDate( TestDate(
"1921-05-01/06-02", "1921-05-01/06-02",
"range", "range",
listOf("0~20.Jahrhundert~", "1~20.Jahrhundert~1921-1930#") listOf("0~20.Jahrhundert~", "1~20.Jahrhundert~1921-1930~#")
), ),
TestDate( TestDate(
"1921/1931", "1921/1931",
"range", "range",
listOf("0~20.Jahrhundert~", "1~20.Jahrhundert~1921-1930#", "1~20.Jahrhundert~1931-1940#") listOf("0~20.Jahrhundert~", "1~20.Jahrhundert~1921-1930~#", "1~20.Jahrhundert~1931-1940~#")
), ),
TestDate( TestDate(
"1921-04-01/1931-05-02", "1921-04-01/1931-05-02",
"range", "range",
listOf("0~20.Jahrhundert~", "1~20.Jahrhundert~1921-1930#", "1~20.Jahrhundert~1931-1940#") listOf("0~20.Jahrhundert~", "1~20.Jahrhundert~1921-1930~#", "1~20.Jahrhundert~1931-1940~#")
), ),
TestDate( TestDate(
"1921/1951", "1921/1951",
"range", "range",
listOf( listOf(
"0~20.Jahrhundert~", "0~20.Jahrhundert~",
"1~20.Jahrhundert~1921-1930#", "1~20.Jahrhundert~1921-1930~#",
"1~20.Jahrhundert~1931-1940#", "1~20.Jahrhundert~1931-1940~#",
"1~20.Jahrhundert~1941-1950#", "1~20.Jahrhundert~1941-1950~#",
"1~20.Jahrhundert~1951-1960#" "1~20.Jahrhundert~1951-1960~#"
) )
), ),
TestDate( TestDate(
...@@ -110,30 +110,30 @@ class Test { ...@@ -110,30 +110,30 @@ class Test {
"0~18.Jahrhundert~", "0~18.Jahrhundert~",
"0~19.Jahrhundert~", "0~19.Jahrhundert~",
"0~20.Jahrhundert~", "0~20.Jahrhundert~",
"1~18.Jahrhundert~1721-1730#", "1~18.Jahrhundert~1721-1730~#",
"1~18.Jahrhundert~1731-1740#", "1~18.Jahrhundert~1731-1740~#",
"1~18.Jahrhundert~1741-1750#", "1~18.Jahrhundert~1741-1750~#",
"1~18.Jahrhundert~1751-1760#", "1~18.Jahrhundert~1751-1760~#",
"1~18.Jahrhundert~1761-1770#", "1~18.Jahrhundert~1761-1770~#",
"1~18.Jahrhundert~1771-1780#", "1~18.Jahrhundert~1771-1780~#",
"1~18.Jahrhundert~1781-1790#", "1~18.Jahrhundert~1781-1790~#",
"1~18.Jahrhundert~1791-1800#", "1~18.Jahrhundert~1791-1800~#",
"1~19.Jahrhundert~1801-1810#", "1~19.Jahrhundert~1801-1810~#",
"1~19.Jahrhundert~1811-1820#", "1~19.Jahrhundert~1811-1820~#",
"1~19.Jahrhundert~1821-1830#", "1~19.Jahrhundert~1821-1830~#",
"1~19.Jahrhundert~1831-1840#", "1~19.Jahrhundert~1831-1840~#",
"1~19.Jahrhundert~1841-1850#", "1~19.Jahrhundert~1841-1850~#",
"1~19.Jahrhundert~1851-1860#", "1~19.Jahrhundert~1851-1860~#",
"1~19.Jahrhundert~1861-1870#", "1~19.Jahrhundert~1861-1870~#",
"1~19.Jahrhundert~1871-1880#", "1~19.Jahrhundert~1871-1880~#",
"1~19.Jahrhundert~1881-1890#", "1~19.Jahrhundert~1881-1890~#",
"1~19.Jahrhundert~1891-1900#", "1~19.Jahrhundert~1891-1900~#",
"1~20.Jahrhundert~1901-1910#", "1~20.Jahrhundert~1901-1910~#",
"1~20.Jahrhundert~1911-1920#", "1~20.Jahrhundert~1911-1920~#",
"1~20.Jahrhundert~1921-1930#", "1~20.Jahrhundert~1921-1930~#",
"1~20.Jahrhundert~1931-1940#", "1~20.Jahrhundert~1931-1940~#",
"1~20.Jahrhundert~1941-1950#", "1~20.Jahrhundert~1941-1950~#",
"1~20.Jahrhundert~1951-1960#" "1~20.Jahrhundert~1951-1960~#"
) )
), ),
TestDate( TestDate(
...@@ -142,17 +142,17 @@ class Test { ...@@ -142,17 +142,17 @@ class Test {
listOf( listOf(
"0~18.Jahrhundert~", "0~18.Jahrhundert~",
"0~19.Jahrhundert~", "0~19.Jahrhundert~",
"1~18.Jahrhundert~1721-1730#", "1~18.Jahrhundert~1721-1730~#",
"1~18.Jahrhundert~1731-1740#", "1~18.Jahrhundert~1731-1740~#",
"1~18.Jahrhundert~1741-1750#", "1~18.Jahrhundert~1741-1750~#",
"1~18.Jahrhundert~1751-1760#", "1~18.Jahrhundert~1751-1760~#",
"1~18.Jahrhundert~1761-1770#", "1~18.Jahrhundert~1761-1770~#",
"1~18.Jahrhundert~1771-1780#", "1~18.Jahrhundert~1771-1780~#",
"1~18.Jahrhundert~1781-1790#", "1~18.Jahrhundert~1781-1790~#",
"1~18.Jahrhundert~1791-1800#", "1~18.Jahrhundert~1791-1800~#",
"1~19.Jahrhundert~1801-1810#", "1~19.Jahrhundert~1801-1810~#",
"1~19.Jahrhundert~1811-1820#", "1~19.Jahrhundert~1811-1820~#",
"1~19.Jahrhundert~1821-1830#" "1~19.Jahrhundert~1821-1830~#"
) )
) )
) )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment