Display comment after entry in grade notifications (#1741)

This commit is contained in:
Mikołaj Pich 2021-12-31 12:36:14 +01:00 committed by GitHub
parent 20673c4ead
commit a03bcf8e62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View File

@ -22,7 +22,10 @@ class NewGradeNotification @Inject constructor(
val notificationDataList = items.map {
NotificationData(
title = context.getPlural(R.plurals.grade_new_items, 1),
content = "${it.subject}: ${it.entry}",
content = buildString {
append("${it.subject}: ${it.entry}")
if (it.comment.isNotBlank()) append(" (${it.comment})")
},
intentToStart = SplashActivity.getStartIntent(context, Destination.Grade),
)
}

View File

@ -5,7 +5,7 @@ import java.time.LocalDate
val debugGradeDetailsItems = listOf(
generateGrade("Matematyka", "+"),
generateGrade("Matematyka", "2="),
generateGrade("Matematyka", "120", comment = "%"),
generateGrade("Fizyka", "-"),
generateGrade("Geografia", "4+"),
generateGrade("Sieci komputerowe", "1"),
@ -17,14 +17,14 @@ val debugGradeDetailsItems = listOf(
generateGrade("Wychowanie fizyczne", "5"),
)
private fun generateGrade(subject: String, entry: String) = Grade(
private fun generateGrade(subject: String, entry: String, comment: String = "") = Grade(
subject = subject,
entry = entry,
semesterId = 0,
studentId = 0,
value = 0.0,
modifier = 0.0,
comment = "",
comment = comment,
color = "",
gradeSymbol = "",
description = "",