Skip to content

Commit

Permalink
Make errors a part of the container
Browse files Browse the repository at this point in the history
  • Loading branch information
v6ak committed Oct 10, 2023
1 parent 4f97421 commit c647a65
Showing 1 changed file with 28 additions and 27 deletions.
55 changes: 28 additions & 27 deletions client/src/main/scala/com/v6ak/zbdb/Renderer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -294,35 +294,36 @@ final class Renderer private(participantTable: ParticipantTable, processingError
private def initialize(): Unit = {
showBar = false
switches.values.foreach(dom.document.body.classList.add)
yearLinksOption match {
case Some(yearLinks) =>
if(!yearLinks.map(_._1).contains(year)){
content.appendChild(
div(cls:="alert alert-danger")("Výsledky pro tento ročník ještě nejsou finální.", br, "Pro adminy: pokud je to již hotovo, jdi do adresáře statistiky a přepiš soubor years.json souborem years.json.new. Tím schválíš všechny nové ročníky jako finální.").render
)
}
case None =>
content.appendChild(
div(cls:="alert alert-danger")("Neporařilo se načíst seznam starších ročníků. Takže vlastně ani nevím, jestli jsou toto finální výsledky.").render
)
}
if(processingErrors.nonEmpty){
content.appendChild(
div(cls:="alert alert-danger")(
s"Některé řádky (celkem ${processingErrors.size}) se nepodařilo zpracovat",
ul(
processingErrors.map{case (row, e) =>
li(
div(showCells(row)),
div(showThrowable(e))
)
}
)
).render
)
}
content.appendChild(
div(`class` := "container")(
yearLinksOption match {
case Some(yearLinks) if !yearLinks.map(_._1).contains(year) => fseq(
div(cls := "alert alert-danger")(
"Výsledky pro tento ročník ještě nejsou finální.", br,
"Pro adminy: pokud je to již hotovo, jdi do adresáře statistiky a přepiš soubor years.json souborem " +
"years.json.new. Tím schválíš všechny nové ročníky jako finální."
)
)
case None => fseq(
div(cls := "alert alert-danger")(
"Neporařilo se načíst seznam ročníků. Takže vlastně ani nevím, jestli jsou toto finální výsledky."
)
)
case _ => fseq()
},
if (processingErrors.nonEmpty) fseq(
div(cls := "alert alert-danger")(
s"Některé řádky (celkem ${processingErrors.size}) se nepodařilo zpracovat",
ul(
processingErrors.map { case (row, e) =>
li(
div(showCells(row)),
div(showThrowable(e))
)
}
)
)
) else fseq(),
h2("Grafy"),
globalStats,
h2("Výsledky"),
Expand Down

0 comments on commit c647a65

Please sign in to comment.