forked from github/szkolny
[APIv2/Librus] Use apply in getting lucky numbers
This commit is contained in:
parent
f79263e628
commit
c03eca3804
@ -25,19 +25,19 @@ class LibrusApiLuckyNumber(override val data: DataLibrus,
|
||||
if (json.isJsonNull) {
|
||||
profile?.luckyNumberEnabled = false
|
||||
} else {
|
||||
profile?.also { profile ->
|
||||
profile.luckyNumber = -1
|
||||
profile.luckyNumberDate = Date.getToday()
|
||||
profile?.apply {
|
||||
luckyNumber = -1
|
||||
luckyNumberDate = Date.getToday()
|
||||
|
||||
json.getJsonObject("LuckyNumber")?.also { luckyNumber ->
|
||||
profile.luckyNumber = luckyNumber.getInt("LuckyNumber") ?: -1
|
||||
profile.luckyNumberDate = Date.fromY_m_d(luckyNumber.getString("LuckyNumberDay"))
|
||||
json.getJsonObject("LuckyNumber")?.also { luckyNumberEl ->
|
||||
luckyNumber = luckyNumberEl.getInt("LuckyNumber") ?: -1
|
||||
luckyNumberDate = Date.fromY_m_d(luckyNumberEl.getString("LuckyNumberDay"))
|
||||
}
|
||||
|
||||
data.luckyNumberList.add(LuckyNumber(
|
||||
profileId,
|
||||
profile.luckyNumberDate ?: Date.getToday(),
|
||||
profile.luckyNumber
|
||||
luckyNumberDate ?: Date.getToday(),
|
||||
luckyNumber
|
||||
))
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user