Untitled
unknown
plain_text
2 years ago
2.2 kB
3
Indexable
Never
private fun rebuildData(mlList: List<Ml>): List<GameInfoEntity> { if (mlList.isEmpty()) { return listOf() } else { val gameInfoEntityList = mutableListOf<GameInfoEntity>() mlList.forEach { ml -> var position = 0 lateinit var gameInfoEntity: GameInfoEntity ml.tyl.forEach { if (position == 0) { gameInfoEntity = GameInfoEntity(GameInfoEntity.GameType.Header.ordinal) } else { gameInfoEntity = GameInfoEntity(GameInfoEntity.GameType.Content.ordinal) } } position++ gameInfoEntityList.add(gameInfoEntity.apply { kindId = ml.kid kindName = ml.kn leagueName = ml.ln myFav = ml.ifm gameTotalOdds = ml.tht val startDateTime = ml.gds.split(" ") gameStartDate = startDateTime[0] gameStartTime = startDateTime[1] val endDateTime = ml.gde.split(" ") gameEndDate = endDateTime[0] gameEndTime = endDateTime[1] ml.tml.forEach { if (it.tt == 1) { hostName = it.tn } else { guestName = it.tn } } val typeList: MutableList<GameInfoEntity.GameTypeData> = mutableListOf() ml.tyl.forEach { tyl -> val typeInfo: MutableList<GameInfoEntity.GameTypeInfoData> = mutableListOf() tyl.til.forEach { til -> typeInfo.add(GameInfoEntity.GameTypeInfoData(til.iid, til.il, til.o, til.hd)) } typeList.add(GameInfoEntity.GameTypeData(tyl.tid, tyl.tn, tyl.rn, typeInfo)) } gameTypeList = typeList }) } return gameInfoEntityList } }