forked from github/szkolny
add support for grade column codes
This commit is contained in:
parent
29fd96acb4
commit
567dd8e6a2
@ -2,11 +2,11 @@
|
||||
"formatVersion": 1,
|
||||
"database": {
|
||||
"version": 100,
|
||||
"identityHash": "4c141460d807d32d00faad4fb3c12522",
|
||||
"identityHash": "26b54e8e64642eb693587f983aaf3adc",
|
||||
"entities": [
|
||||
{
|
||||
"tableName": "grades",
|
||||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`profileId` INTEGER NOT NULL, `gradeId` INTEGER NOT NULL, `gradeName` TEXT NOT NULL, `gradeType` INTEGER NOT NULL, `gradeValue` REAL NOT NULL, `gradeWeight` REAL NOT NULL, `gradeColor` INTEGER NOT NULL, `gradeCategory` TEXT, `gradeDescription` TEXT, `gradeComment` TEXT, `gradeSemester` INTEGER NOT NULL, `teacherId` INTEGER NOT NULL, `subjectId` INTEGER NOT NULL, `addedDate` INTEGER NOT NULL, `gradeValueMax` REAL, `gradeClassAverage` REAL, `gradeParentId` INTEGER, `gradeIsImprovement` INTEGER NOT NULL, `keep` INTEGER NOT NULL, PRIMARY KEY(`profileId`, `gradeId`))",
|
||||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`profileId` INTEGER NOT NULL, `gradeId` INTEGER NOT NULL, `gradeName` TEXT NOT NULL, `gradeType` INTEGER NOT NULL, `gradeValue` REAL NOT NULL, `gradeWeight` REAL NOT NULL, `gradeColor` INTEGER NOT NULL, `code` TEXT, `gradeCategory` TEXT, `gradeDescription` TEXT, `gradeComment` TEXT, `gradeSemester` INTEGER NOT NULL, `teacherId` INTEGER NOT NULL, `subjectId` INTEGER NOT NULL, `addedDate` INTEGER NOT NULL, `gradeValueMax` REAL, `gradeClassAverage` REAL, `gradeParentId` INTEGER, `gradeIsImprovement` INTEGER NOT NULL, `keep` INTEGER NOT NULL, PRIMARY KEY(`profileId`, `gradeId`))",
|
||||
"fields": [
|
||||
{
|
||||
"fieldPath": "profileId",
|
||||
@ -50,6 +50,12 @@
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "code",
|
||||
"columnName": "code",
|
||||
"affinity": "TEXT",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "category",
|
||||
"columnName": "gradeCategory",
|
||||
@ -124,11 +130,11 @@
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"autoGenerate": false,
|
||||
"columnNames": [
|
||||
"profileId",
|
||||
"gradeId"
|
||||
],
|
||||
"autoGenerate": false
|
||||
]
|
||||
},
|
||||
"indices": [
|
||||
{
|
||||
@ -197,11 +203,11 @@
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"autoGenerate": false,
|
||||
"columnNames": [
|
||||
"profileId",
|
||||
"teacherId"
|
||||
],
|
||||
"autoGenerate": false
|
||||
]
|
||||
},
|
||||
"indices": [],
|
||||
"foreignKeys": []
|
||||
@ -278,11 +284,11 @@
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"autoGenerate": false,
|
||||
"columnNames": [
|
||||
"profileId",
|
||||
"teacherAbsenceId"
|
||||
],
|
||||
"autoGenerate": false
|
||||
]
|
||||
},
|
||||
"indices": [
|
||||
{
|
||||
@ -321,11 +327,11 @@
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"autoGenerate": false,
|
||||
"columnNames": [
|
||||
"profileId",
|
||||
"teacherAbsenceTypeId"
|
||||
],
|
||||
"autoGenerate": false
|
||||
]
|
||||
},
|
||||
"indices": [],
|
||||
"foreignKeys": []
|
||||
@ -366,11 +372,11 @@
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"autoGenerate": false,
|
||||
"columnNames": [
|
||||
"profileId",
|
||||
"subjectId"
|
||||
],
|
||||
"autoGenerate": false
|
||||
]
|
||||
},
|
||||
"indices": [],
|
||||
"foreignKeys": []
|
||||
@ -441,11 +447,11 @@
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"autoGenerate": false,
|
||||
"columnNames": [
|
||||
"profileId",
|
||||
"noticeId"
|
||||
],
|
||||
"autoGenerate": false
|
||||
]
|
||||
},
|
||||
"indices": [
|
||||
{
|
||||
@ -502,11 +508,11 @@
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"autoGenerate": false,
|
||||
"columnNames": [
|
||||
"profileId",
|
||||
"teamId"
|
||||
],
|
||||
"autoGenerate": false
|
||||
]
|
||||
},
|
||||
"indices": [],
|
||||
"foreignKeys": []
|
||||
@ -619,11 +625,11 @@
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"autoGenerate": false,
|
||||
"columnNames": [
|
||||
"profileId",
|
||||
"attendanceId"
|
||||
],
|
||||
"autoGenerate": false
|
||||
]
|
||||
},
|
||||
"indices": [
|
||||
{
|
||||
@ -770,11 +776,11 @@
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"autoGenerate": false,
|
||||
"columnNames": [
|
||||
"profileId",
|
||||
"eventId"
|
||||
],
|
||||
"autoGenerate": false
|
||||
]
|
||||
},
|
||||
"indices": [
|
||||
{
|
||||
@ -843,11 +849,11 @@
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"autoGenerate": false,
|
||||
"columnNames": [
|
||||
"profileId",
|
||||
"eventType"
|
||||
],
|
||||
"autoGenerate": false
|
||||
]
|
||||
},
|
||||
"indices": [],
|
||||
"foreignKeys": []
|
||||
@ -882,10 +888,10 @@
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"autoGenerate": false,
|
||||
"columnNames": [
|
||||
"loginStoreId"
|
||||
],
|
||||
"autoGenerate": false
|
||||
]
|
||||
},
|
||||
"indices": [],
|
||||
"foreignKeys": []
|
||||
@ -1046,10 +1052,10 @@
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"autoGenerate": false,
|
||||
"columnNames": [
|
||||
"profileId"
|
||||
],
|
||||
"autoGenerate": false
|
||||
]
|
||||
},
|
||||
"indices": [],
|
||||
"foreignKeys": []
|
||||
@ -1084,11 +1090,11 @@
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"autoGenerate": false,
|
||||
"columnNames": [
|
||||
"profileId",
|
||||
"luckyNumberDate"
|
||||
],
|
||||
"autoGenerate": false
|
||||
]
|
||||
},
|
||||
"indices": [],
|
||||
"foreignKeys": []
|
||||
@ -1159,11 +1165,11 @@
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"autoGenerate": false,
|
||||
"columnNames": [
|
||||
"profileId",
|
||||
"announcementId"
|
||||
],
|
||||
"autoGenerate": false
|
||||
]
|
||||
},
|
||||
"indices": [
|
||||
{
|
||||
@ -1238,12 +1244,12 @@
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"autoGenerate": false,
|
||||
"columnNames": [
|
||||
"profileId",
|
||||
"categoryId",
|
||||
"type"
|
||||
],
|
||||
"autoGenerate": false
|
||||
]
|
||||
},
|
||||
"indices": [],
|
||||
"foreignKeys": []
|
||||
@ -1308,10 +1314,10 @@
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"autoGenerate": true,
|
||||
"columnNames": [
|
||||
"messageId"
|
||||
],
|
||||
"autoGenerate": true
|
||||
]
|
||||
},
|
||||
"indices": [],
|
||||
"foreignKeys": []
|
||||
@ -1400,11 +1406,11 @@
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"autoGenerate": false,
|
||||
"columnNames": [
|
||||
"profileId",
|
||||
"messageId"
|
||||
],
|
||||
"autoGenerate": false
|
||||
]
|
||||
},
|
||||
"indices": [
|
||||
{
|
||||
@ -1456,12 +1462,12 @@
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"autoGenerate": false,
|
||||
"columnNames": [
|
||||
"profileId",
|
||||
"messageRecipientId",
|
||||
"messageId"
|
||||
],
|
||||
"autoGenerate": false
|
||||
]
|
||||
},
|
||||
"indices": [],
|
||||
"foreignKeys": []
|
||||
@ -1484,10 +1490,10 @@
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"autoGenerate": true,
|
||||
"columnNames": [
|
||||
"id"
|
||||
],
|
||||
"autoGenerate": true
|
||||
]
|
||||
},
|
||||
"indices": [],
|
||||
"foreignKeys": []
|
||||
@ -1528,11 +1534,11 @@
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"autoGenerate": false,
|
||||
"columnNames": [
|
||||
"profileId",
|
||||
"endpointId"
|
||||
],
|
||||
"autoGenerate": false
|
||||
]
|
||||
},
|
||||
"indices": [],
|
||||
"foreignKeys": []
|
||||
@ -1567,11 +1573,11 @@
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"autoGenerate": false,
|
||||
"columnNames": [
|
||||
"profileId",
|
||||
"lessonRangeNumber"
|
||||
],
|
||||
"autoGenerate": false
|
||||
]
|
||||
},
|
||||
"indices": [],
|
||||
"foreignKeys": []
|
||||
@ -1648,10 +1654,10 @@
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"autoGenerate": true,
|
||||
"columnNames": [
|
||||
"id"
|
||||
],
|
||||
"autoGenerate": true
|
||||
]
|
||||
},
|
||||
"indices": [],
|
||||
"foreignKeys": []
|
||||
@ -1680,11 +1686,11 @@
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"autoGenerate": false,
|
||||
"columnNames": [
|
||||
"profileId",
|
||||
"id"
|
||||
],
|
||||
"autoGenerate": false
|
||||
]
|
||||
},
|
||||
"indices": [],
|
||||
"foreignKeys": []
|
||||
@ -1713,11 +1719,11 @@
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"autoGenerate": false,
|
||||
"columnNames": [
|
||||
"profileId",
|
||||
"id"
|
||||
],
|
||||
"autoGenerate": false
|
||||
]
|
||||
},
|
||||
"indices": [],
|
||||
"foreignKeys": []
|
||||
@ -1770,11 +1776,11 @@
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"autoGenerate": false,
|
||||
"columnNames": [
|
||||
"profileId",
|
||||
"id"
|
||||
],
|
||||
"autoGenerate": false
|
||||
]
|
||||
},
|
||||
"indices": [],
|
||||
"foreignKeys": []
|
||||
@ -1923,11 +1929,11 @@
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"autoGenerate": false,
|
||||
"columnNames": [
|
||||
"profileId",
|
||||
"id"
|
||||
],
|
||||
"autoGenerate": false
|
||||
]
|
||||
},
|
||||
"indices": [
|
||||
{
|
||||
@ -1979,11 +1985,11 @@
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"autoGenerate": false,
|
||||
"columnNames": [
|
||||
"profileId",
|
||||
"key"
|
||||
],
|
||||
"autoGenerate": false
|
||||
]
|
||||
},
|
||||
"indices": [],
|
||||
"foreignKeys": []
|
||||
@ -2024,11 +2030,11 @@
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"autoGenerate": false,
|
||||
"columnNames": [
|
||||
"profileId",
|
||||
"lessonId"
|
||||
],
|
||||
"autoGenerate": false
|
||||
]
|
||||
},
|
||||
"indices": [
|
||||
{
|
||||
@ -2127,10 +2133,10 @@
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"autoGenerate": true,
|
||||
"columnNames": [
|
||||
"id"
|
||||
],
|
||||
"autoGenerate": true
|
||||
]
|
||||
},
|
||||
"indices": [
|
||||
{
|
||||
@ -2228,10 +2234,10 @@
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"autoGenerate": false,
|
||||
"columnNames": [
|
||||
"noteId"
|
||||
],
|
||||
"autoGenerate": false
|
||||
]
|
||||
},
|
||||
"indices": [
|
||||
{
|
||||
@ -2290,10 +2296,10 @@
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"autoGenerate": true,
|
||||
"columnNames": [
|
||||
"metadataId"
|
||||
],
|
||||
"autoGenerate": true
|
||||
]
|
||||
},
|
||||
"indices": [
|
||||
{
|
||||
@ -2314,7 +2320,7 @@
|
||||
"views": [],
|
||||
"setupQueries": [
|
||||
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
|
||||
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '4c141460d807d32d00faad4fb3c12522')"
|
||||
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '26b54e8e64642eb693587f983aaf3adc')"
|
||||
]
|
||||
}
|
||||
}
|
2326
app/schemas/pl.szczodrzynski.edziennik.data.db.AppDb/101.json
Normal file
2326
app/schemas/pl.szczodrzynski.edziennik.data.db.AppDb/101.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -58,7 +58,8 @@ class LibrusApiBehaviourGrades(override val data: DataLibrus,
|
||||
semester = 1,
|
||||
teacherId = -1,
|
||||
subjectId = 1,
|
||||
addedDate = profile.getSemesterStart(1).inMillis
|
||||
addedDate = profile.getSemesterStart(1).inMillis,
|
||||
code = null
|
||||
)
|
||||
|
||||
data.gradeList.add(semester1StartGradeObject)
|
||||
@ -86,7 +87,8 @@ class LibrusApiBehaviourGrades(override val data: DataLibrus,
|
||||
semester = 2,
|
||||
teacherId = -1,
|
||||
subjectId = 1,
|
||||
addedDate = profile.getSemesterStart(2).inMillis
|
||||
addedDate = profile.getSemesterStart(2).inMillis,
|
||||
code = null
|
||||
)
|
||||
|
||||
data.gradeList.add(semester2StartGradeObject)
|
||||
@ -158,7 +160,8 @@ class LibrusApiBehaviourGrades(override val data: DataLibrus,
|
||||
semester = semester,
|
||||
teacherId = teacherId,
|
||||
subjectId = 1,
|
||||
addedDate = addedDate
|
||||
addedDate = addedDate,
|
||||
code = null
|
||||
).apply {
|
||||
valueMax = valueTo
|
||||
}
|
||||
|
@ -68,7 +68,8 @@ class LibrusApiDescriptiveGrades(override val data: DataLibrus,
|
||||
semester = semester,
|
||||
teacherId = teacherId,
|
||||
subjectId = subjectId,
|
||||
addedDate = addedDate
|
||||
addedDate = addedDate,
|
||||
code = null
|
||||
)
|
||||
|
||||
data.gradeList.add(gradeObject)
|
||||
|
@ -82,7 +82,8 @@ class LibrusApiGrades(override val data: DataLibrus,
|
||||
semester = semester,
|
||||
teacherId = teacherId,
|
||||
subjectId = subjectId,
|
||||
addedDate = addedDate
|
||||
addedDate = addedDate,
|
||||
code = null
|
||||
)
|
||||
|
||||
grade.getJsonObject("Improvement")?.also {
|
||||
|
@ -59,7 +59,8 @@ class LibrusApiPointGrades(override val data: DataLibrus,
|
||||
semester = semester,
|
||||
teacherId = teacherId,
|
||||
subjectId = subjectId,
|
||||
addedDate = addedDate
|
||||
addedDate = addedDate,
|
||||
code = null
|
||||
).apply {
|
||||
valueMax = category?.valueTo ?: 0f
|
||||
}
|
||||
|
@ -63,7 +63,8 @@ class LibrusApiTextGrades(override val data: DataLibrus,
|
||||
semester = semester,
|
||||
teacherId = teacherId,
|
||||
subjectId = subjectId,
|
||||
addedDate = addedDate
|
||||
addedDate = addedDate,
|
||||
code = null
|
||||
)
|
||||
|
||||
data.gradeList.add(gradeObject)
|
||||
|
@ -81,7 +81,8 @@ class MobidziennikApiGrades(val data: DataMobidziennik, rows: List<String>) {
|
||||
semester = semester,
|
||||
teacherId = teacherId,
|
||||
subjectId = subjectId,
|
||||
addedDate = addedDate
|
||||
addedDate = addedDate,
|
||||
code = null
|
||||
)
|
||||
|
||||
if (data.profile?.empty == true) {
|
||||
|
@ -128,7 +128,8 @@ class MobidziennikWebGrades(override val data: DataMobidziennik,
|
||||
semester = gradeSemester,
|
||||
teacherId = teacherId,
|
||||
subjectId = subjectId,
|
||||
addedDate = gradeAddedDateMillis
|
||||
addedDate = gradeAddedDateMillis,
|
||||
code = null
|
||||
)
|
||||
|
||||
gradeObject.classAverage = gradeClassAverage
|
||||
|
@ -57,7 +57,8 @@ class PodlasieApiFinalGrades(val data: DataPodlasie, val rows: List<JsonObject>)
|
||||
semester = semester,
|
||||
teacherId = -1,
|
||||
subjectId = subject.id,
|
||||
addedDate = addedDate
|
||||
addedDate = addedDate,
|
||||
code = null
|
||||
)
|
||||
|
||||
data.gradeList.add(gradeObject)
|
||||
@ -94,7 +95,8 @@ class PodlasieApiFinalGrades(val data: DataPodlasie, val rows: List<JsonObject>)
|
||||
semester = semester,
|
||||
teacherId = -1,
|
||||
subjectId = subject.id,
|
||||
addedDate = addedDate
|
||||
addedDate = addedDate,
|
||||
code = null
|
||||
)
|
||||
|
||||
data.gradeList.add(proposedGradeObject)
|
||||
|
@ -27,6 +27,7 @@ class PodlasieApiGrades(val data: DataPodlasie, val rows: List<JsonObject>) {
|
||||
val includeToAverage = grade.getInt("IncludeToAverage") != 0
|
||||
val color = grade.getString("Color")?.let { Color.parseColor(it) } ?: -1
|
||||
val category = grade.getString("Category") ?: ""
|
||||
val code = grade.getString("Code") ?: ""
|
||||
val comment = grade.getString("Comment") ?: ""
|
||||
val semester = grade.getString("TermShortcut")?.length ?: data.currentSemester
|
||||
|
||||
@ -54,7 +55,8 @@ class PodlasieApiGrades(val data: DataPodlasie, val rows: List<JsonObject>) {
|
||||
semester = semester,
|
||||
teacherId = teacher.id,
|
||||
subjectId = subject.id,
|
||||
addedDate = addedDate
|
||||
addedDate = addedDate,
|
||||
code = code
|
||||
)
|
||||
|
||||
data.gradeList.add(gradeObject)
|
||||
|
@ -66,7 +66,8 @@ class VulcanHebeGradeSummary(
|
||||
semester = data.studentSemesterNumber,
|
||||
teacherId = -1,
|
||||
subjectId = subjectId,
|
||||
addedDate = addedDate
|
||||
addedDate = addedDate,
|
||||
code = null
|
||||
)
|
||||
|
||||
data.gradeList.add(gradeObject)
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
package pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.data.hebe
|
||||
|
||||
import pl.szczodrzynski.edziennik.*
|
||||
import pl.szczodrzynski.edziennik.data.api.VULCAN_HEBE_ENDPOINT_GRADES
|
||||
import pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.DataVulcan
|
||||
import pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.ENDPOINT_VULCAN_HEBE_GRADES
|
||||
@ -39,6 +38,7 @@ class VulcanHebeGrades(
|
||||
val column = grade.getJsonObject("Column")
|
||||
val category = column.getJsonObject("Category")
|
||||
val categoryText = category.getString("Name")
|
||||
val code = column.getString("Code").orNullIfEmpty()
|
||||
|
||||
val teacherId = getTeacherId(grade, "Creator") ?: -1
|
||||
val subjectId = getSubjectId(column, "Subject") ?: -1
|
||||
@ -100,6 +100,7 @@ class VulcanHebeGrades(
|
||||
weight = weight,
|
||||
color = color,
|
||||
category = categoryText,
|
||||
code = code,
|
||||
description = finalDescription,
|
||||
comment = null,
|
||||
semester = getSemester(column),
|
||||
|
@ -44,7 +44,7 @@ import pl.szczodrzynski.edziennik.data.db.migration.*
|
||||
TimetableManual::class,
|
||||
Note::class,
|
||||
Metadata::class
|
||||
], version = 100)
|
||||
], version = 101)
|
||||
@TypeConverters(
|
||||
ConverterTime::class,
|
||||
ConverterDate::class,
|
||||
@ -189,6 +189,7 @@ abstract class AppDb : RoomDatabase() {
|
||||
Migration98(),
|
||||
Migration99(),
|
||||
Migration100(),
|
||||
Migration101()
|
||||
).allowMainThreadQueries().build()
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,12 @@ open class Grade(
|
||||
@ColumnInfo(name = "gradeColor")
|
||||
var color: Int,
|
||||
|
||||
/**
|
||||
* Applies only for Vulcan (i think)
|
||||
*/
|
||||
@ColumnInfo(name = "code")
|
||||
var code: String?,
|
||||
|
||||
@ColumnInfo(name = "gradeCategory")
|
||||
var category: String?,
|
||||
@ColumnInfo(name = "gradeDescription")
|
||||
|
@ -10,12 +10,12 @@ import pl.szczodrzynski.edziennik.data.db.entity.Noteable
|
||||
|
||||
class GradeFull(
|
||||
profileId: Int, id: Long, name: String, type: Int,
|
||||
value: Float, weight: Float, color: Int,
|
||||
value: Float, weight: Float, color: Int, code: String?,
|
||||
category: String?, description: String?, comment: String?,
|
||||
semester: Int, teacherId: Long, subjectId: Long, addedDate: Long = System.currentTimeMillis()
|
||||
) : Grade(
|
||||
profileId, id, name, type,
|
||||
value, weight, color,
|
||||
value, weight, color, code,
|
||||
category, description, comment,
|
||||
semester, teacherId, subjectId, addedDate
|
||||
), Noteable {
|
||||
|
@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Copyright (c) Kuba Szczodrzyński 2022-10-25.
|
||||
* Copyright (c) Franciszek Pilch 2024-06-14.
|
||||
*/
|
||||
|
||||
package pl.szczodrzynski.edziennik.data.db.migration
|
||||
|
||||
import androidx.room.migration.Migration
|
||||
import androidx.sqlite.db.SupportSQLiteDatabase
|
||||
|
||||
class Migration101 : Migration(100, 101) {
|
||||
override fun migrate(database: SupportSQLiteDatabase) {
|
||||
database.execSQL("ALTER TABLE grades ADD COLUMN code TEXT DEFAULT NULL;")
|
||||
}
|
||||
}
|
@ -141,6 +141,8 @@ fun String.fixWhiteSpaces() = buildString(length) {
|
||||
}
|
||||
}.trimEnd()
|
||||
|
||||
fun String?.orNullIfEmpty(): String? = if (this.isNullOrEmpty()) null else this
|
||||
|
||||
fun CharSequence?.asColoredSpannable(colorInt: Int): Spannable {
|
||||
val spannable = SpannableString(this)
|
||||
spannable.setSpan(ForegroundColorSpan(colorInt), 0, spannable.length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||
|
@ -30,6 +30,11 @@ class GradeViewHolder(
|
||||
@Suppress("PARAMETER_NAME_CHANGED_ON_OVERRIDE")
|
||||
override fun onBind(activity: AppCompatActivity, app: App, grade: GradeFull, position: Int, adapter: GradesAdapter) {
|
||||
val manager = app.gradesManager
|
||||
val gradeCategoryText: String = when {
|
||||
grade.category != null && grade.code != null -> "${grade.code} - ${grade.category}"
|
||||
grade.code != null -> grade.code!!
|
||||
else -> grade.category!!
|
||||
}
|
||||
|
||||
b.gradeName.setGrade(grade, manager, bigView = true)
|
||||
|
||||
@ -40,15 +45,15 @@ class GradeViewHolder(
|
||||
if (grade.isImprovement)
|
||||
app.getString(R.string.grades_improvement_category_format, "")
|
||||
else
|
||||
""
|
||||
if (grade.code != null) gradeCategoryText else null
|
||||
} else {
|
||||
b.gradeDescription.text =
|
||||
grade.getNoteSubstituteText(adapter.showNotes) ?: grade.description
|
||||
b.gradeCategory.text =
|
||||
if (grade.isImprovement)
|
||||
app.getString(R.string.grades_improvement_category_format, grade.category)
|
||||
app.getString(R.string.grades_improvement_category_format, gradeCategoryText)
|
||||
else
|
||||
grade.category
|
||||
gradeCategoryText
|
||||
}
|
||||
|
||||
if (adapter.showNotes)
|
||||
|
@ -157,6 +157,23 @@
|
||||
android:textIsSelectable="true"
|
||||
tools:text="@string/dialog_grade_details_no_category" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/dialog_grade_details_code"
|
||||
android:textAppearance="@style/NavView.TextView.BodyMedium"
|
||||
android:textStyle="bold"
|
||||
android:textColor="?colorPrimary" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="0dp"
|
||||
android:text="@{Utils.ns(@string/dialog_grade_details_no_code, grade.code)}"
|
||||
android:textIsSelectable="true"
|
||||
tools:text="@string/dialog_grade_details_no_code" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@ -164,8 +181,7 @@
|
||||
android:text="@string/dialog_grade_details_description"
|
||||
android:textAppearance="@style/NavView.TextView.BodyMedium"
|
||||
android:textStyle="bold"
|
||||
android:textColor="?colorPrimary"
|
||||
/>
|
||||
android:textColor="?colorPrimary" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
|
@ -1229,4 +1229,6 @@
|
||||
<string name="edziennik_progress_endpoint_addressbook">Addressbuch herunterladen…</string>
|
||||
<string name="settings_ui_lock_layout_text">Sperren des Startbildschirm-Layouts</string>
|
||||
<string name="settings_ui_lock_layout_subtext">Sie können keine Elemente auf dem Startbildschirm bearbeiten</string>
|
||||
<string name="dialog_grade_details_code">Notenspaltencode</string>
|
||||
<string name="dialog_grade_details_no_code">(kein Notenspaltencode)</string>
|
||||
</resources>
|
||||
|
@ -1436,4 +1436,6 @@
|
||||
<string name="home_timetable_all_lessons">All lessons:</string>
|
||||
<string name="settings_ui_lock_layout_text">Lock home screen layout</string>
|
||||
<string name="settings_ui_lock_layout_subtext">You will not be able to edit items on the home screen</string>
|
||||
<string name="dialog_grade_details_code">Grade column code</string>
|
||||
<string name="dialog_grade_details_no_code">(no column code)</string>
|
||||
</resources>
|
||||
|
@ -1556,4 +1556,6 @@
|
||||
<string name="menu_timetable_sync">Odśwież wybrany tydzień</string>
|
||||
<string name="settings_ui_lock_layout_text">Zablokuj układ ekranu głównego</string>
|
||||
<string name="settings_ui_lock_layout_subtext">Nie będzie można edytować przedmiotów na ekranie głównym</string>
|
||||
<string name="dialog_grade_details_code">Kod oceny</string>
|
||||
<string name="dialog_grade_details_no_code">(brak kodu)</string>
|
||||
</resources>
|
||||
|
Loading…
x
Reference in New Issue
Block a user