From 4f0021919c7aa57aca54de0f5a4c29f623306e34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Pich?= Date: Thu, 7 Mar 2019 13:08:59 +0100 Subject: [PATCH] Fix grade stats loading issues (#266) --- app/build.gradle | 2 +- .../wulkanowy/data/repositories/message/MessageRemote.kt | 4 ++-- .../data/repositories/recipient/RecipientRemote.kt | 4 ++-- .../ui/modules/grade/statistics/GradeStatisticsFragment.kt | 1 + .../ui/modules/grade/statistics/GradeStatisticsPresenter.kt | 1 + app/src/main/res/layout/fragment_grade_statistics.xml | 6 ++++-- app/src/main/res/values-pl/strings.xml | 2 +- app/src/main/res/values/strings.xml | 2 +- 8 files changed, 13 insertions(+), 9 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 4d53481b..f1345fb1 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -72,7 +72,7 @@ play { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - implementation('com.github.wulkanowy:api:46f09bdf34') { exclude module: "threetenbp" } + implementation('com.github.wulkanowy:api:ea81799e98') { exclude module: "threetenbp" } implementation "androidx.legacy:legacy-support-v4:1.0.0" implementation "androidx.appcompat:appcompat:1.0.2" diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/message/MessageRemote.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/message/MessageRemote.kt index b751f8c5..6d388471 100644 --- a/app/src/main/java/io/github/wulkanowy/data/repositories/message/MessageRemote.kt +++ b/app/src/main/java/io/github/wulkanowy/data/repositories/message/MessageRemote.kt @@ -26,7 +26,7 @@ class MessageRemote @Inject constructor(private val api: Api) { sender = it.sender.orEmpty(), senderId = it.senderId ?: 0, recipient = it.recipient.orEmpty(), - recipientId = it.recipientId, + recipientId = 0, subject = it.subject.trim(), date = it.date?.toLocalDateTime() ?: now(), folderId = it.folderId, @@ -50,7 +50,7 @@ class MessageRemote @Inject constructor(private val api: Api) { recipients = recipients.map { ApiRecipient( id = it.realId, - realName = it.realName, + name = it.realName, loginId = it.loginId, reportingUnitId = it.unitId, role = it.role, diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/recipient/RecipientRemote.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/recipient/RecipientRemote.kt index f3ef3ee2..21f49649 100644 --- a/app/src/main/java/io/github/wulkanowy/data/repositories/recipient/RecipientRemote.kt +++ b/app/src/main/java/io/github/wulkanowy/data/repositories/recipient/RecipientRemote.kt @@ -17,12 +17,12 @@ class RecipientRemote @Inject constructor(private val api: Api) { Recipient( studentId = api.studentId, name = it.name, - realName = it.realName, + realName = it.name, realId = it.id, hash = it.hash, loginId = it.loginId, role = it.role, - unitId = it.reportingUnitId + unitId = it.reportingUnitId ?: 0 ) } } diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/statistics/GradeStatisticsFragment.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/statistics/GradeStatisticsFragment.kt index 2bd51eac..9b7912d1 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/statistics/GradeStatisticsFragment.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/statistics/GradeStatisticsFragment.kt @@ -130,6 +130,7 @@ class GradeStatisticsFragment : BaseSessionFragment(), GradeStatisticsView, Grad override fun showSubjects(show: Boolean) { gradeStatisticsSubjectsContainer.visibility = if (show) View.VISIBLE else View.INVISIBLE + gradeStatisticsTypeSwitch.visibility = if (show) View.VISIBLE else View.INVISIBLE } override fun clearView() { diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/statistics/GradeStatisticsPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/statistics/GradeStatisticsPresenter.kt index 073231c0..c383ec8b 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/statistics/GradeStatisticsPresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/statistics/GradeStatisticsPresenter.kt @@ -74,6 +74,7 @@ class GradeStatisticsPresenter @Inject constructor( fun onTypeChange(isSemester: Boolean) { Timber.i("Select attendance stats semester: $isSemester") + disposable.clear() view?.run { showContent(false) showProgress(true) diff --git a/app/src/main/res/layout/fragment_grade_statistics.xml b/app/src/main/res/layout/fragment_grade_statistics.xml index 2fcb1196..9c7f3795 100644 --- a/app/src/main/res/layout/fragment_grade_statistics.xml +++ b/app/src/main/res/layout/fragment_grade_statistics.xml @@ -56,7 +56,9 @@ android:layout_gravity="center" android:gravity="center" android:orientation="horizontal" - android:paddingTop="5dp"> + android:paddingTop="5dp" + android:visibility="invisible" + tools:visibility="visible"> Obliczona średnia Końcowa średnia Podsumowanie - Oceny klasy + Klasa Oznacz jako przeczytane Oceny cząstkowe Oceny semestralne diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 4a2cc916..b51387e9 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -60,7 +60,7 @@ Calculated average Final average Summary - Class grades + Class Mark as read Partial grades Semester grades