From 75c94865e40513e3ccb8930c66910b66562d6639 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Pich?= Date: Sat, 29 Feb 2020 23:07:47 +0100 Subject: [PATCH] Sort the second group's lessons below the student's lessons (#706) --- .travis.yml | 6 +++--- app/build.gradle | 2 +- .../wulkanowy/ui/modules/timetable/TimetablePresenter.kt | 2 +- .../ui/modules/timetablewidget/TimetableWidgetFactory.kt | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4771be527..902cb13d9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -49,9 +49,9 @@ script: - ./gradlew dependencies --stacktrace --daemon - fossa --no-ansi || true #- ./gradlew lintPlayRelease -x fabricGenerateResourcesPlayRelease --stacktrace --daemon - - ./gradlew testPlayDebugUnitTest -x fabricGenerateResourcesPlay --stacktrace --daemon - - ./gradlew createFdroidDebugCoverageReport --stacktrace --daemon - - ./gradlew jacocoTestReport --stacktrace --daemon + - ./gradlew -Pcoverage testPlayDebugUnitTest -x fabricGenerateResourcesPlay --stacktrace --daemon + - ./gradlew -Pcoverage createFdroidDebugCoverageReport --stacktrace --daemon + - ./gradlew -Pcoverage jacocoTestReport --stacktrace --daemon - if [ -z ${SONAR_HOST+x} ]; then echo "sonar scan skipped"; else git fetch --unshallow; ./gradlew sonarqube -x test -x lint -x fabricGenerateResourcesPlayRelease -x fabricGenerateResourcesFdroidRelease -Dsonar.host.url=$SONAR_HOST -Dsonar.organization=$SONAR_ORG -Dsonar.login=$SONAR_KEY -Dsonar.branch.name=${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH} --stacktrace --daemon; diff --git a/app/build.gradle b/app/build.gradle index 622c4b12c..8b22c3bdd 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -61,7 +61,7 @@ android { buildConfigField "boolean", "CRASHLYTICS_ENABLED", project.hasProperty("enableCrashlytics") ? "true" : "false" applicationIdSuffix ".dev" versionNameSuffix "-dev" - testCoverageEnabled = true + testCoverageEnabled = project.hasProperty('coverage') ext.enableCrashlytics = project.hasProperty("enableCrashlytics") } } diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetablePresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetablePresenter.kt index 7916a4b87..913f6c121 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetablePresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetablePresenter.kt @@ -138,7 +138,7 @@ class TimetablePresenter @Inject constructor( .delay(200, MILLISECONDS) .flatMap { timetableRepository.getTimetable(it, currentDate, currentDate, forceRefresh) } .map { createTimetableItems(it) } - .map { items -> items.sortedBy { it.lesson.number } } + .map { items -> items.sortedWith(compareBy({ it.lesson.number }, { !it.lesson.isStudentPlan })) } .subscribeOn(schedulers.backgroundThread) .observeOn(schedulers.mainThread) .doFinally { diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/timetablewidget/TimetableWidgetFactory.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/timetablewidget/TimetableWidgetFactory.kt index 0141e4d32..62620b8ed 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/timetablewidget/TimetableWidgetFactory.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/timetablewidget/TimetableWidgetFactory.kt @@ -109,7 +109,7 @@ class TimetableWidgetFactory( } .flatMap { semesterRepository.getCurrentSemester(it).toMaybe() } .flatMap { timetableRepository.getTimetable(it, date, date).toMaybe() } - .map { item -> item.sortedBy { it.number } } + .map { items -> items.sortedWith(compareBy({ it.number }, { !it.isStudentPlan })) } .map { lessons -> lessons.filter { if (prefRepository.showWholeClassPlan == "no") it.isStudentPlan else true } } .subscribeOn(schedulers.backgroundThread) .blockingGet(emptyList())