fix: feedback ex3
This commit is contained in:
parent
4a8e87f444
commit
5b1bd3e135
@ -83,26 +83,22 @@ case class TopSongs(songs: List[Song] = List()) {
|
||||
TopSongs(song :: songs)
|
||||
}
|
||||
def printSongs(): Unit = {
|
||||
songs.foreach(song => {
|
||||
songs.map(song => {
|
||||
val title = song.title
|
||||
val singer = song.singer
|
||||
val producers = song.producer.map(_.create()).mkString(", ")
|
||||
val streak = song.rank._1.streak.getOrElse("no")
|
||||
val pos = song.rank._2.pos.getOrElse("NA")
|
||||
|
||||
if (singer.exists(a => {
|
||||
a.isInstanceOf[God]
|
||||
})) {
|
||||
println(s"$title by God ${singer.map(_.person.name).mkString(", ")} spent $streak weeks on the charts on Pos. $pos")
|
||||
} else {
|
||||
println(
|
||||
singer match {
|
||||
case s if s.exists(_.person.isInstanceOf[God]) => println(s"$title by God ${singer.map(_.person.name).mkString(", ")} spent $streak weeks on the charts on Pos. $pos")
|
||||
case _ => println(
|
||||
s"$title by ${singer.map(_.person.name).mkString(", ")}. " +
|
||||
s"$producers this song that " +
|
||||
s"spent $streak weeks " +
|
||||
s"on the charts on Pos. $pos"
|
||||
)
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user