Created
February 8, 2019 11:48
-
-
Save RobertApikyan/65f0a2b9bbee82cc1e415e9bdf3dabb0 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
{ companies -> | |
val ac = mutableListOf<Company.UserAccessViewModel>() | |
for (company in companies) { | |
val status = UserManegmentCompanyStatus.firstOrUndefined(company.approvalStatus) | |
val hasAccess = userCompanyList.indexOfFirst { it.id == company.id }.isNotUndefined | |
if (status == UserManegmentCompanyStatus.APPROVED || (status == UserManegmentCompanyStatus.WAITING && hasAccess)) { | |
ac.add(Company.UserAccessViewModel(company, hasAccess)) | |
} | |
} | |
ac.sortBy { !it.hasAccess } | |
return@mutateAsync ac | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment