Created
June 29, 2018 13:55
-
-
Save IlyaHalsky/39fdf494463335dba6787c33ae9ef089 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def resetAction: State ⇒ State = { | |
if (errorMap.nonEmpty) PrintColored("r")(s"Warning: This list $listUniqueName contains columns with same srcIds: $errorMap") | |
val columns: List[Access[ReactColumnSetting]] = getColumns.map(col ⇒ columnSettingsMap(col.columnSrcId + listUniqueName)) | |
val resetColumnsAction: List[State ⇒ State] = | |
for { | |
col ← columns | |
} yield { | |
val init = col.initialValue | |
col.updatingLens.get.set(init.copy( | |
displayOrder = None, | |
priority = columnMap.get(init.columnIdPlusListId).flatten, | |
sortOrder = None, | |
sortAscending = None, | |
newOrder = false, | |
priorityOpen = false, | |
orderOpen = false | |
)) | |
} | |
val consensusReset = consensusInitValue.updatingLens.get.set(consensusInitValue.initialValue.copy( | |
pendingChange = false, | |
activeOrders = Nil, | |
totalOrdered = 0 | |
)) | |
resetColumnsAction.fold(consensusReset)((a, b) ⇒ a andThen b) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment