gpt-3.5-turbo-0613· OpenAI
WildChat-4.8M (AI2)
private fun getExpireDate(date: LocalDate?): LocalDate? { date ?: return null when…
- User
private fun getExpireDate(date: LocalDate?): LocalDate? { date ?: return null when (documentType) { DocumentType.ID_CARD.uuid, DocumentType.PASSPORT_OF_FOREIGN_CITIZEN.uuid -> { if (country == Country.KYRGIZSTAN.id) { return date.plusYears(10) } return date.apply { plusYears(10) minusDays(1) } }
DocumentType.PATENT.uuid -> { return date.plusYears(1) } DocumentType.RESIDENCE_PERMIT.uuid -> { return date.plusYears(3) } else -> return null } }перепиши более понятно и лаконично
- Assistant
fun getExpireDate(date: LocalDate?): LocalDate? { return date?.let { when (documentType) { DocumentType.ID_CARD.uuid, DocumentType.PASSPORT_OF_FOREIGN_CITIZEN.uuid -> { if (country == Country.KYRGIZSTAN.id) { it.plusYears(10) } else { it.plusYears(10).minusDays(1) } } DocumentType.PATENT.uuid -> it.plusYears(1) DocumentType.RESIDENCE_PERMIT.uuid -> it.plusYears(3) else -> null } } }