forked from github/szkolny
[Events] Fix event sorting. Fix showing event teacher name.
This commit is contained in:
parent
bc0918a115
commit
c6e1ff2164
@ -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"""
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 } ?: ""
|
||||
)
|
||||
|
||||
|
@ -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),
|
||||
|
@ -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()) {
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user