[Events] Fix event sorting. Fix showing event teacher name.

This commit is contained in:
Kuba Szczodrzyński 2020-03-29 15:26:48 +02:00
parent bc0918a115
commit c6e1ff2164
7 changed files with 11 additions and 11 deletions

View File

@ -33,7 +33,7 @@ abstract class EventDao : BaseDao<Event, EventFull> {
LEFT JOIN metadata ON eventId = thingId AND (thingType = ${Metadata.TYPE_EVENT} OR thingType = ${Metadata.TYPE_HOMEWORK}) AND metadata.profileId = events.profileId
"""
private const val ORDER_BY = """GROUP BY eventId ORDER BY addedDate ASC"""
private const val ORDER_BY = """GROUP BY eventId ORDER BY eventDate, eventTime, addedDate ASC"""
private const val NOT_BLACKLISTED = """events.eventBlacklisted = 0"""
}

View File

@ -40,7 +40,7 @@ class EventFull(
var typeName: String? = null
var typeColor: Int? = null
var teacherFullName: String? = null
var teacherName: String? = null
var subjectLongName: String? = null
var subjectShortName: String? = null
var teamName: String? = null

View File

@ -102,14 +102,14 @@ class EventDetailsDialog(
when (event.sharedBy) {
null -> when {
event.addedManually -> R.string.event_details_added_by_self_format
event.teacherFullName == null -> R.string.event_details_added_by_unknown_format
event.teacherName == null -> R.string.event_details_added_by_unknown_format
else -> R.string.event_details_added_by_format
}
"self" -> R.string.event_details_shared_by_self_format
else -> R.string.event_details_shared_by_format
},
Date.fromMillis(event.addedDate).formattedString,
event.sharedByName ?: event.teacherFullName ?: ""
event.sharedByName ?: event.teacherName ?: ""
)
b.editButton.visibility = if (event.addedManually) View.VISIBLE else View.GONE

View File

@ -61,14 +61,14 @@ class EventListAdapter(
when (event.sharedBy) {
null -> when {
event.addedManually -> R.string.event_list_added_by_self_format
event.teacherFullName == null -> R.string.event_list_added_by_unknown_format
event.teacherName == null -> R.string.event_list_added_by_unknown_format
else -> R.string.event_list_added_by_format
}
"self" -> R.string.event_list_shared_by_self_format
else -> R.string.event_list_shared_by_format
},
Date.fromMillis(event.addedDate).formattedString,
event.sharedByName ?: event.teacherFullName ?: "",
event.sharedByName ?: event.teacherName ?: "",
event.teamName?.let { bullet+it } ?: ""
)

View File

@ -226,7 +226,7 @@ class AgendaFragment : Fragment(), CoroutineScope {
"",
(if (event.time == null) getString(R.string.agenda_event_all_day) else event.time!!.stringHM) +
(event.subjectLongName?.let { ", $it" } ?: "") +
(event.teacherFullName?.let { ", $it" } ?: "") +
(event.teacherName?.let { ", $it" } ?: "") +
(event.teamName?.let { ", $it" } ?: ""),
event.eventColor,
Colors.legibleTextColor(event.eventColor),

View File

@ -54,7 +54,7 @@ public class HomeworkAdapter extends RecyclerView.Adapter<HomeworkAdapter.ViewHo
holder.homeworkItemHomeworkDate.setText(app.getString(R.string.date_relative_format, homework.getDate().getFormattedString(), Date.dayDiffString(context, diffDays)));
holder.homeworkItemTopic.setText(homework.getTopic());
holder.homeworkItemSubjectTeacher.setText(context.getString(R.string.homework_subject_teacher_format, bs(homework.getSubjectLongName()), bs(homework.getTeacherFullName())));
holder.homeworkItemSubjectTeacher.setText(context.getString(R.string.homework_subject_teacher_format, bs(homework.getSubjectLongName()), bs(homework.getTeacherName())));
holder.homeworkItemTeamDate.setText(context.getString(R.string.homework_team_date_format, bs(homework.getTeamName()), Date.fromMillis(homework.getAddedDate()).getFormattedStringShort()));
if (!homework.getSeen()) {

View File

@ -107,13 +107,13 @@
android:layout_height="wrap_content"
android:textAppearance="@style/NavView.TextView.Helper"
android:text="@string/dialog_event_details_teacher"
android:visibility="@{event.teacherFullName != null ? View.VISIBLE : View.GONE}"/>
android:visibility="@{event.teacherName != null ? View.VISIBLE : View.GONE}"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@{event.teacherFullName}"
android:text="@{event.teacherName}"
android:textIsSelectable="true"
android:visibility="@{event.teacherFullName != null ? View.VISIBLE : View.GONE}"
android:visibility="@{event.teacherName != null ? View.VISIBLE : View.GONE}"
tools:text="Janósz Kowalski" />
<TextView