Skip to content

Commit

Permalink
Switch to Scala 3 (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
v6ak committed Oct 16, 2023
1 parent 7dea748 commit 5ec9de2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
8 changes: 5 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import java.io.IOException

val appVersion= "1.0"

lazy val scalaV = "2.13.12"
lazy val scalaV2 = "2.13.12"

lazy val scalaV3 = "3.3.1"

val bootstrapVersion = "5.3.2"

Expand Down Expand Up @@ -54,7 +56,7 @@ lazy val server = (project in file("server")).settings(
version := appVersion,
name := "zbdb-stats-server",
scalacOptions ++= Seq("-deprecation", "-feature"),
scalaVersion := scalaV,
scalaVersion := scalaV2,
scalaJSProjects := Seq(client),
scalaJSStage := FullOptStage,
Assets / pipelineStages := Seq(scalaJSPipeline),
Expand Down Expand Up @@ -115,7 +117,7 @@ lazy val client = (project in file("client")).settings(
version := appVersion,
scalacOptions ++= Seq("-deprecation", "-feature"),
scalaJSStage := FullOptStage,
scalaVersion := scalaV,
scalaVersion := scalaV3,
scalaJSUseMainModuleInitializer := true,
Test / scalaJSUseMainModuleInitializer := false,
webpack / version := "5.88.2", // https://github.com/ScalablyTyped/Converter/issues/546
Expand Down
6 changes: 3 additions & 3 deletions client/src/main/scala/com/v6ak/zbdb/Parser.scala
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ object Parser{

def parse(csvData: String, startTime: Moment, totalEndTime: Moment, maxHourDelta: Int, formatVersion: FormatVersion) = {
val fullDataTable: IndexedSeq[IndexedSeq[String]] = CsvParser.parse(csvData)
val Seq(header1, header2, header3, dataWithTail @ _*) = fullDataTable.drop(formatVersion.headSize)
val Seq(header1, header2, header3, dataWithTail @ _*) = fullDataTable.drop(formatVersion.headSize) : @unchecked
val (dataTable, footer) = formatVersion.tail.split(dataWithTail.dropWhile(_.head == "").toIndexedSeq)
footer.foreach{fl =>
assertEmpty(fl.toSet.filterNot(_.forall(c => c.isDigit || c==':')) -- Set("", "nejdříve na stanovišti", "nejrychleji projitý úsek", "Na trati"))
Expand Down Expand Up @@ -150,9 +150,9 @@ object Parser{
private def isUsefulCell(cell: String): Boolean = cell != "" && cell != "X" && cell != "0:00"

private def parseParticipant(participantData: immutable.IndexedSeq[String], parts: immutable.IndexedSeq[Part], startTime: Moment, maxHourDelta: Int, totalEndTime: Moment, formatVersion: FormatVersion): Participant = {
val Seq(num, participantDataAfterNum@_*) = participantData
val Seq(num, participantDataAfterNum@_*) = participantData : @unchecked
val (firstName, lastName, nick, participantDataAfterName) = formatVersion.nameFormat.parse(participantDataAfterNum)
val Seq(genderString, ageString, other@_*) = participantDataAfterName
val Seq(genderString, ageString, other@_*) = participantDataAfterName : @unchecked
if ((formatVersion.ageType == AgeType.No) && (ageString != "")) {
sys.error("You seem to have left some data in age column. Clean it first, please.")
}
Expand Down
4 changes: 2 additions & 2 deletions client/src/main/scala/com/v6ak/zbdb/ParticipantTable.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ final case class ParticipantTable (startTime: Moment, parts: Seq[Part], data: Se
}
val finishedParticipantsInContext = finishedParticipantsGroups.flatten
val bestTotalTimeOption = finishedParticipantsInContext.headOption.map(_.totalTime)
val unfinishedParticipantsInContext = unfinishedParticipants.map(ParticipantInContext.Failed)
val unfinishedParticipantsInContext = unfinishedParticipants.map(ParticipantInContext.Failed.apply)
val allParticipantsInContext = finishedParticipantsInContext ++ unfinishedParticipantsInContext
(allParticipantsInContext.map(pic => pic.participant -> pic).toMap, bestTotalTimeOption)
}
Expand Down Expand Up @@ -144,7 +144,7 @@ final case class ParticipantTable (startTime: Moment, parts: Seq[Part], data: Se
row.partTimes lazyZip
nextPartInfos
)
.map(FullPartInfo)
.map(FullPartInfo.apply)
.zipWithIndex
.flatMap((partWalkEvents(row) _).tupled)
}
Expand Down

0 comments on commit 5ec9de2

Please sign in to comment.