Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kuring-38 [수정] 서버에서 학과 이름이 바뀌었을 때 로컬 DB에도 반영하도록 수정 #65

Merged
merged 12 commits into from
Aug 21, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,10 @@ class DepartmentRepositoryImpl @Inject constructor(
}

private suspend fun updateDepartmentsName(departments: List<Department>) {
val sortedOriginalDepartments = this.departments?.sortedBy { it.name }
val sortedOriginalDepartments = getAllDepartments().sortedBy { it.name }
val updateTargets = departments.filter { department ->
val originalPosition =
sortedOriginalDepartments?.binarySearch { it.name.compareTo(department.name) }
?: return@filter true
sortedOriginalDepartments.binarySearch { it.name.compareTo(department.name) }
yeon-kyu marked this conversation as resolved.
Show resolved Hide resolved
val originalDepartment = sortedOriginalDepartments[originalPosition]
return@filter originalDepartment.name != department.name || originalDepartment.koreanName != department.koreanName
yeon-kyu marked this conversation as resolved.
Show resolved Hide resolved
}
Expand Down