diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
deleted file mode 100644
index d744bdd1..00000000
--- a/.github/workflows/test.yml
+++ /dev/null
@@ -1,142 +0,0 @@
-name: Test and deploy
-
-on:
- push:
- branches: [ develop ]
- tags: [ '*' ]
- pull_request:
- branches: [ develop ]
-
- workflow_dispatch:
-
-jobs:
- build:
- name: Pre-build
- runs-on: ubuntu-latest
- timeout-minutes: 10
- steps:
- - uses: fkirc/skip-duplicate-actions@master
- - uses: actions/checkout@v2
- - uses: gradle/wrapper-validation-action@v1
- - uses: actions/setup-java@v1
- with:
- java-version: 11
- - uses: actions/cache@v2
- with:
- path: |
- ~/.gradle/caches
- ~/.gradle/wrapper
- key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}
- - name: Build
- run: ./gradlew --build-cache compileFdroidDebugUnitTestKotlin preFdroidDebugAndroidTestBuild dexBuilderFdroidDebugAndroidTest packageFdroidDebug packageFdroidDebugAndroidTest
- - name: Prepare build cache
- run: tar -cf prebuild.tar .build-cache .gradle app/build
- - uses: actions/upload-artifact@v2
- with:
- name: prebuild.tar
- path: prebuild.tar
-
- unit-tests:
- name: Unit tests
- runs-on: ubuntu-latest
- timeout-minutes: 10
- needs: [ build ]
- steps:
- - uses: actions/checkout@v2
- - uses: actions/setup-java@v1
- with:
- java-version: 11
- - uses: actions/cache@v2
- with:
- path: |
- ~/.gradle/caches
- ~/.gradle/wrapper
- key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}
- - uses: actions/download-artifact@v2
- with:
- name: prebuild.tar
- - name: Extract build cache
- run: tar -xf prebuild.tar
- - name: Unit tests
- run: |
- ./gradlew --build-cache -Pcoverage testFdroidDebugUnitTest --stacktrace
- ./gradlew --build-cache -Pcoverage jacocoTestReport --stacktrace
- - uses: codecov/codecov-action@v1
- with:
- flags: unit
-
- instrumentation-tests:
- name: Instrumentation tests
- runs-on: macOS-latest
- timeout-minutes: 15
- needs: [ build ]
- strategy:
- fail-fast: true
- matrix:
- api-level: [21, 29]
- steps:
- - uses: actions/checkout@v2
- - uses: actions/setup-java@v1
- with:
- java-version: 11
- - uses: actions/cache@v2
- with:
- path: |
- ~/.gradle/caches
- ~/.gradle/wrapper
- key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}
- - uses: actions/download-artifact@v2
- with:
- name: prebuild.tar
- - name: Extract build cache
- run: tar -xf prebuild.tar
- - name: Instrumentation tests
- uses: reactivecircus/android-emulator-runner@v2
- with:
- api-level: ${{ matrix.api-level }}
- arch: x86
- script: |
- ./gradlew --build-cache -Pcoverage connectedFdroidDebugAndroidTest --stacktrace
- ./gradlew --build-cache -Pcoverage jacocoTestReport --stacktrace
- - uses: codecov/codecov-action@v1
- with:
- flags: instrumented,api-${{ matrix.api-level }}
-
- deploy-google-play:
- name: Deploy to google play
- runs-on: ubuntu-latest
- timeout-minutes: 10
- environment: google-play
- needs: [ build, unit-tests, instrumentation-tests ]
- if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
- steps:
- - uses: actions/checkout@v2
- - uses: actions/setup-java@v1
- with:
- java-version: 11
- - uses: actions/cache@v2
- with:
- path: |
- ~/.gradle/caches
- ~/.gradle/wrapper
- key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}
- - uses: actions/download-artifact@v2
- with:
- name: prebuild.tar
- - name: Extract build cache
- run: tar -xf prebuild.tar
- - name: Decrypt keys
- env:
- ENCRYPT_KEY: ${{ secrets.ENCRYPT_KEY }}
- SERVICES_ENCRYPT_KEY: ${{ secrets.SERVICES_ENCRYPT_KEY }}
- run: |
- gpg --yes --batch --passphrase=$SERVICES_ENCRYPT_KEY ./app/src/release/google-services.json.gpg
- gpg --yes --batch --passphrase=$ENCRYPT_KEY ./app/key.p12.gpg
- gpg --yes --batch --passphrase=$ENCRYPT_KEY ./app/upload-key.jks.gpg
- - name: Upload apk to google play
- env:
- PLAY_KEY_ALIAS: ${{ secrets.PLAY_KEY_ALIAS }}
- PLAY_KEY_PASSWORD: ${{ secrets.PLAY_KEY_PASSWORD }}
- PLAY_SERVICE_ACCOUNT_EMAIL: ${{ secrets.PLAY_SERVICE_ACCOUNT_EMAIL }}
- PLAY_STORE_PASSWORD: ${{ secrets.PLAY_STORE_PASSWORD }}
- run: ./gradlew publishPlayRelease -PenableFirebase --stacktrace;
diff --git a/.gitignore b/.gitignore
index 5d3321e3..d3fb6e4e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,7 +19,6 @@ out/
# Gradle files
.gradle/
build/
-.build-cache
# Local configuration file (sdk path, etc)
local.properties
@@ -114,6 +113,3 @@ Thumbs.db
!/gradle/wrapper/gradle-wrapper.jar
.idea/jarRepositories.xml
-
-
-app/src/release/agconnect-services.json
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
index 0ac66f64..cb2f4119 100644
--- a/.idea/codeStyles/Project.xml
+++ b/.idea/codeStyles/Project.xml
@@ -18,9 +18,18 @@
+
+
+
+
+
+
+
-
+
+
+
@@ -134,11 +143,13 @@
-
+
+
+
diff --git a/.travis.yml b/.travis.yml
index 04db3a61..e383a74b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -14,7 +14,7 @@ cache:
branches:
only:
- develop
- - 0.24.0
+ - 0.22.0
android:
licenses:
@@ -58,7 +58,6 @@ script:
- |
if [ $TRAVIS_TAG ]; then
gpg --yes --batch --passphrase=$SERVICES_ENCRYPT_KEY ./app/src/release/google-services.json.gpg;
- gpg --yes --batch --passphrase=$SERVICES_ENCRYPT_KEY ./app/src/release/agconnect-services.json.gpg;
gpg --yes --batch --passphrase=$ENCRYPT_KEY ./app/key.p12.gpg;
gpg --yes --batch --passphrase=$ENCRYPT_KEY ./app/upload-key.jks.gpg;
./gradlew publishPlayRelease -PenableFirebase --stacktrace;
diff --git a/README.en.md b/README.en.md
index accc3608..4c5e53da 100644
--- a/README.en.md
+++ b/README.en.md
@@ -1,8 +1,7 @@
[Polska wersja README](README.md)
# Wulkanowy
-
-[](https://github.com/wulkanowy/wulkanowy/actions)
+[](https://travis-ci.com/wulkanowy/wulkanowy)
[](https://codecov.io/gh/wulkanowy/wulkanowy)
[](https://discord.gg/vccAQBr)
[](https://f-droid.org/packages/io.github.wulkanowy/)
@@ -51,8 +50,7 @@ You can also download a [development version](https://wulkanowy.github.io/#downl
* [Wulkanowy SDK](https://github.com/wulkanowy/sdk)
-* [Kotlin Coroutines](https://kotlinlang.org/docs/reference/coroutines-overview.html)
-* [Hilt](https://dagger.dev/hilt/)
+* [Dagger 2](https://github.com/google/dagger)
* [Room](https://developer.android.com/topic/libraries/architecture/room)
* [WorkManager](https://developer.android.com/topic/libraries/architecture/workmanager)
diff --git a/README.md b/README.md
index ca3b5590..9e29cdb6 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,7 @@
[English version of README](README.en.md)
# Wulkanowy
-
-[](https://github.com/wulkanowy/wulkanowy/actions)
+[](https://travis-ci.com/wulkanowy/wulkanowy)
[](https://codecov.io/gh/wulkanowy/wulkanowy)
[](https://discord.gg/vccAQBr)
[](https://f-droid.org/packages/io.github.wulkanowy/)
@@ -51,9 +50,8 @@ Możesz także pobrać [wersję rozwojową](https://wulkanowy.github.io/#downloa
## Zbudowana za pomocą
-* [Wulkanowy SDK](https://github.com/wulkanowy/sdk)
-* [Kotlin Coroutines](https://kotlinlang.org/docs/reference/coroutines-overview.html)
-* [Hilt](https://dagger.dev/hilt/)
+* [Wulkanowy SDK](https://github.com/wulkanowy/SDK)
+* [Dagger 2](https://github.com/google/dagger)
* [Room](https://developer.android.com/topic/libraries/architecture/room)
* [WorkManager](https://developer.android.com/topic/libraries/architecture/workmanager)
diff --git a/app/build.gradle b/app/build.gradle
index a822c367..b1ba7e62 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -11,22 +11,19 @@ apply from: 'hooks.gradle'
android {
compileSdkVersion 30
- buildToolsVersion '30.0.3'
+ buildToolsVersion '30.0.2'
defaultConfig {
applicationId "io.github.wulkanowy"
testApplicationId "io.github.tests.wulkanowy"
minSdkVersion 17
targetSdkVersion 30
- versionCode 84
- versionName "1.0.0"
+ versionCode 73
+ versionName "0.22.0"
multiDexEnabled true
+ resValue "string", "app_name", "Wulkanowy"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
-
- resValue "string", "app_name", "Wulkanowy"
- buildConfigField "long", "BUILD_TIMESTAMP", String.valueOf(System.currentTimeMillis())
-
manifestPlaceholders = [
firebase_enabled: project.hasProperty("enableFirebase")
]
@@ -72,26 +69,12 @@ android {
flavorDimensions "platform"
productFlavors {
- hms {
- dimension "platform"
- minSdkVersion 19
- manifestPlaceholders = [
- install_channel: "AppGallery"
- ]
- }
-
play {
dimension "platform"
- manifestPlaceholders = [
- install_channel: "Google Play"
- ]
}
fdroid {
dimension "platform"
- manifestPlaceholders = [
- install_channel: "F-Droid"
- ]
}
}
@@ -129,25 +112,28 @@ play {
serviceAccountCredentials = file('key.p12')
defaultToAppBundles = false
track = 'alpha'
- updatePriority = 3
+ updatePriority = 0
}
ext {
- work_manager = "2.5.0"
- work_hilt = "1.0.0-alpha03"
- room = "2.3.0-beta01"
- chucker = "3.4.0"
- mockk = "1.10.5"
+ work_manager = "2.4.0"
+ room = "2.2.5"
+ chucker = "3.3.0"
+ mockk = "1.10.2"
moshi = "1.11.0"
}
-dependencies {
- implementation "io.github.wulkanowy:sdk:1.0.0"
+configurations.all {
+ resolutionStrategy.force "androidx.constraintlayout:constraintlayout:1.1.3"
+}
- coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.1'
+dependencies {
+ implementation "io.github.wulkanowy:sdk:0.22.0"
+
+ coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.10'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
- implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.2'
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9'
implementation "androidx.core:core-ktx:1.3.2"
implementation "androidx.activity:activity-ktx:1.1.0"
@@ -161,14 +147,15 @@ dependencies {
implementation "androidx.recyclerview:recyclerview:1.1.0"
implementation "androidx.viewpager:viewpager:1.0.0"
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
- implementation "androidx.constraintlayout:constraintlayout:2.0.4"
+ implementation "androidx.constraintlayout:constraintlayout:2.0.1"
implementation "androidx.coordinatorlayout:coordinatorlayout:1.1.0"
- implementation "com.google.android.material:material:1.3.0-rc01"
+ implementation "com.google.android.material:material:1.2.1"
implementation "com.github.wulkanowy:material-chips-input:2.1.1"
implementation "com.github.PhilJay:MPAndroidChart:v3.1.0"
+ implementation "me.zhanghai.android.materialprogressbar:library:1.6.1"
implementation "androidx.work:work-runtime-ktx:$work_manager"
- playImplementation "androidx.work:work-gcm:$work_manager"
+ implementation "androidx.work:work-gcm:$work_manager"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.2.0"
@@ -178,12 +165,12 @@ dependencies {
implementation "com.google.dagger:hilt-android:$hilt_version"
kapt "com.google.dagger:hilt-android-compiler:$hilt_version"
- implementation "androidx.hilt:hilt-work:$work_hilt"
- kapt "androidx.hilt:hilt-compiler:$work_hilt"
+ implementation 'androidx.hilt:hilt-work:1.0.0-alpha02'
+ kapt 'androidx.hilt:hilt-compiler:1.0.0-alpha02'
implementation "com.aurelhubert:ahbottomnavigation:2.3.4"
implementation "com.ncapdevi:frag-nav:3.3.0"
- implementation "com.github.YarikSOffice:lingver:1.3.0"
+ implementation "com.github.YarikSOffice:lingver:1.2.2"
implementation "com.squareup.moshi:moshi:$moshi"
implementation "com.squareup.moshi:moshi-adapters:$moshi"
@@ -193,31 +180,26 @@ dependencies {
implementation "fr.bipi.treessence:treessence:0.3.2"
implementation "com.mikepenz:aboutlibraries-core:$about_libraries"
implementation 'com.wdullaer:materialdatetimepicker:4.2.3'
- implementation "io.coil-kt:coil:1.1.1"
+ implementation "io.coil-kt:coil:1.0.0-rc3"
implementation "io.github.wulkanowy:AppKillerManager:3.0.0"
implementation 'me.xdrop:fuzzywuzzy:1.3.1'
- playImplementation platform('com.google.firebase:firebase-bom:26.4.0')
- playImplementation 'com.google.firebase:firebase-analytics-ktx'
- playImplementation 'com.google.firebase:firebase-inappmessaging-display-ktx'
- playImplementation "com.google.firebase:firebase-inappmessaging-ktx"
- playImplementation 'com.google.firebase:firebase-messaging:'
- playImplementation 'com.google.firebase:firebase-crashlytics:'
+ playImplementation 'com.google.firebase:firebase-analytics:17.6.0'
+ playImplementation 'com.google.firebase:firebase-inappmessaging-display-ktx:19.1.1'
+ playImplementation "com.google.firebase:firebase-inappmessaging-ktx:19.1.1"
+ playImplementation 'com.google.firebase:firebase-messaging:20.3.0'
+ playImplementation 'com.google.firebase:firebase-crashlytics:17.2.2'
playImplementation 'com.google.android.play:core-ktx:1.8.1'
playImplementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
- hmsImplementation 'com.huawei.hms:hianalytics:5.1.0.301'
- hmsImplementation 'com.huawei.agconnect:agconnect-crash:1.5.0.200'
-
releaseImplementation "com.github.ChuckerTeam.Chucker:library-no-op:$chucker"
debugImplementation "com.github.ChuckerTeam.Chucker:library:$chucker"
debugImplementation "com.amitshekhar.android:debug-db:1.0.6"
- testImplementation "junit:junit:4.13.1"
+ testImplementation "junit:junit:4.13"
testImplementation "io.mockk:mockk:$mockk"
- testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.4.2'
- testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
+ testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.3.9'
androidTestImplementation "androidx.test:core:1.3.0"
androidTestImplementation "androidx.test:runner:1.3.0"
@@ -228,4 +210,3 @@ dependencies {
}
apply plugin: 'com.google.gms.google-services'
-apply plugin: 'com.huawei.agconnect'
diff --git a/app/jacoco.gradle b/app/jacoco.gradle
index 94469fbc..a5cf84e6 100644
--- a/app/jacoco.gradle
+++ b/app/jacoco.gradle
@@ -7,7 +7,6 @@ jacoco {
tasks.withType(Test) {
jacoco.includeNoLocationClasses = true
- jacoco.excludes = ['jdk.internal.*']
}
task jacocoTestReport(type: JacocoReport) {
diff --git a/app/schemas/io.github.wulkanowy.data.db.AppDatabase/28.json b/app/schemas/io.github.wulkanowy.data.db.AppDatabase/28.json
deleted file mode 100644
index c7c4c033..00000000
--- a/app/schemas/io.github.wulkanowy.data.db.AppDatabase/28.json
+++ /dev/null
@@ -1,1842 +0,0 @@
-{
- "formatVersion": 1,
- "database": {
- "version": 28,
- "identityHash": "3a449a55ea73fbfbb7973f1f3f834e10",
- "entities": [
- {
- "tableName": "Students",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `scrapper_base_url` TEXT NOT NULL, `mobile_base_url` TEXT NOT NULL, `login_type` TEXT NOT NULL, `login_mode` TEXT NOT NULL, `certificate_key` TEXT NOT NULL, `private_key` TEXT NOT NULL, `is_parent` INTEGER NOT NULL, `email` TEXT NOT NULL, `password` TEXT NOT NULL, `symbol` TEXT NOT NULL, `student_id` INTEGER NOT NULL, `user_login_id` INTEGER NOT NULL, `user_name` TEXT NOT NULL, `student_name` TEXT NOT NULL, `school_id` TEXT NOT NULL, `school_short` TEXT NOT NULL, `school_name` TEXT NOT NULL, `class_name` TEXT NOT NULL, `class_id` INTEGER NOT NULL, `is_current` INTEGER NOT NULL, `registration_date` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "scrapperBaseUrl",
- "columnName": "scrapper_base_url",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "mobileBaseUrl",
- "columnName": "mobile_base_url",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "loginType",
- "columnName": "login_type",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "loginMode",
- "columnName": "login_mode",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "certificateKey",
- "columnName": "certificate_key",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "privateKey",
- "columnName": "private_key",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "isParent",
- "columnName": "is_parent",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "email",
- "columnName": "email",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "password",
- "columnName": "password",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "symbol",
- "columnName": "symbol",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "userLoginId",
- "columnName": "user_login_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "userName",
- "columnName": "user_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "studentName",
- "columnName": "student_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "schoolSymbol",
- "columnName": "school_id",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "schoolShortName",
- "columnName": "school_short",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "schoolName",
- "columnName": "school_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "className",
- "columnName": "class_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "classId",
- "columnName": "class_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isCurrent",
- "columnName": "is_current",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "registrationDate",
- "columnName": "registration_date",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [
- {
- "name": "index_Students_email_symbol_student_id_school_id_class_id",
- "unique": true,
- "columnNames": [
- "email",
- "symbol",
- "student_id",
- "school_id",
- "class_id"
- ],
- "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_Students_email_symbol_student_id_school_id_class_id` ON `${TABLE_NAME}` (`email`, `symbol`, `student_id`, `school_id`, `class_id`)"
- }
- ],
- "foreignKeys": []
- },
- {
- "tableName": "Semesters",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_current` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `diary_name` TEXT NOT NULL, `school_year` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `semester_name` INTEGER NOT NULL, `start` INTEGER NOT NULL, `end` INTEGER NOT NULL, `class_id` INTEGER NOT NULL, `unit_id` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "current",
- "columnName": "is_current",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryName",
- "columnName": "diary_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "schoolYear",
- "columnName": "school_year",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterName",
- "columnName": "semester_name",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "start",
- "columnName": "start",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "end",
- "columnName": "end",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "classId",
- "columnName": "class_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "unitId",
- "columnName": "unit_id",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [
- {
- "name": "index_Semesters_student_id_diary_id_semester_id",
- "unique": true,
- "columnNames": [
- "student_id",
- "diary_id",
- "semester_id"
- ],
- "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_Semesters_student_id_diary_id_semester_id` ON `${TABLE_NAME}` (`student_id`, `diary_id`, `semester_id`)"
- }
- ],
- "foreignKeys": []
- },
- {
- "tableName": "Exams",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `entry_date` INTEGER NOT NULL, `subject` TEXT NOT NULL, `group` TEXT NOT NULL, `type` TEXT NOT NULL, `description` TEXT NOT NULL, `teacher` TEXT NOT NULL, `teacher_symbol` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "entryDate",
- "columnName": "entry_date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "group",
- "columnName": "group",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "type",
- "columnName": "type",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "description",
- "columnName": "description",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherSymbol",
- "columnName": "teacher_symbol",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Timetable",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `number` INTEGER NOT NULL, `start` INTEGER NOT NULL, `end` INTEGER NOT NULL, `date` INTEGER NOT NULL, `subject` TEXT NOT NULL, `subjectOld` TEXT NOT NULL, `group` TEXT NOT NULL, `room` TEXT NOT NULL, `roomOld` TEXT NOT NULL, `teacher` TEXT NOT NULL, `teacherOld` TEXT NOT NULL, `info` TEXT NOT NULL, `student_plan` INTEGER NOT NULL, `changes` INTEGER NOT NULL, `canceled` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "number",
- "columnName": "number",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "start",
- "columnName": "start",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "end",
- "columnName": "end",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "subjectOld",
- "columnName": "subjectOld",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "group",
- "columnName": "group",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "room",
- "columnName": "room",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "roomOld",
- "columnName": "roomOld",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherOld",
- "columnName": "teacherOld",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "info",
- "columnName": "info",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "isStudentPlan",
- "columnName": "student_plan",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "changes",
- "columnName": "changes",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "canceled",
- "columnName": "canceled",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Attendance",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `time_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `number` INTEGER NOT NULL, `subject` TEXT NOT NULL, `name` TEXT NOT NULL, `presence` INTEGER NOT NULL, `absence` INTEGER NOT NULL, `exemption` INTEGER NOT NULL, `lateness` INTEGER NOT NULL, `excused` INTEGER NOT NULL, `deleted` INTEGER NOT NULL, `excusable` INTEGER NOT NULL, `excuse_status` TEXT)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "timeId",
- "columnName": "time_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "number",
- "columnName": "number",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "presence",
- "columnName": "presence",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "absence",
- "columnName": "absence",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "exemption",
- "columnName": "exemption",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "lateness",
- "columnName": "lateness",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "excused",
- "columnName": "excused",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "deleted",
- "columnName": "deleted",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "excusable",
- "columnName": "excusable",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "excuseStatus",
- "columnName": "excuse_status",
- "affinity": "TEXT",
- "notNull": false
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "AttendanceSummary",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `subject_id` INTEGER NOT NULL, `month` INTEGER NOT NULL, `presence` INTEGER NOT NULL, `absence` INTEGER NOT NULL, `absence_excused` INTEGER NOT NULL, `absence_for_school_reasons` INTEGER NOT NULL, `lateness` INTEGER NOT NULL, `lateness_excused` INTEGER NOT NULL, `exemption` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subjectId",
- "columnName": "subject_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "month",
- "columnName": "month",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "presence",
- "columnName": "presence",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "absence",
- "columnName": "absence",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "absenceExcused",
- "columnName": "absence_excused",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "absenceForSchoolReasons",
- "columnName": "absence_for_school_reasons",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "lateness",
- "columnName": "lateness",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "latenessExcused",
- "columnName": "lateness_excused",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "exemption",
- "columnName": "exemption",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Grades",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_read` INTEGER NOT NULL, `is_notified` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `subject` TEXT NOT NULL, `entry` TEXT NOT NULL, `value` REAL NOT NULL, `modifier` REAL NOT NULL, `comment` TEXT NOT NULL, `color` TEXT NOT NULL, `grade_symbol` TEXT NOT NULL, `description` TEXT NOT NULL, `weight` TEXT NOT NULL, `weightValue` REAL NOT NULL, `date` INTEGER NOT NULL, `teacher` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isRead",
- "columnName": "is_read",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isNotified",
- "columnName": "is_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "entry",
- "columnName": "entry",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "value",
- "columnName": "value",
- "affinity": "REAL",
- "notNull": true
- },
- {
- "fieldPath": "modifier",
- "columnName": "modifier",
- "affinity": "REAL",
- "notNull": true
- },
- {
- "fieldPath": "comment",
- "columnName": "comment",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "color",
- "columnName": "color",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "gradeSymbol",
- "columnName": "grade_symbol",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "description",
- "columnName": "description",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "weight",
- "columnName": "weight",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "weightValue",
- "columnName": "weightValue",
- "affinity": "REAL",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "GradesSummary",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_predicted_grade_notified` INTEGER NOT NULL, `is_final_grade_notified` INTEGER NOT NULL, `predicted_grade_last_change` INTEGER NOT NULL, `final_grade_last_change` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `position` INTEGER NOT NULL, `subject` TEXT NOT NULL, `predicted_grade` TEXT NOT NULL, `final_grade` TEXT NOT NULL, `proposed_points` TEXT NOT NULL, `final_points` TEXT NOT NULL, `points_sum` TEXT NOT NULL, `average` REAL NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isPredictedGradeNotified",
- "columnName": "is_predicted_grade_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isFinalGradeNotified",
- "columnName": "is_final_grade_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "predictedGradeLastChange",
- "columnName": "predicted_grade_last_change",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "finalGradeLastChange",
- "columnName": "final_grade_last_change",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "position",
- "columnName": "position",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "predictedGrade",
- "columnName": "predicted_grade",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "finalGrade",
- "columnName": "final_grade",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "proposedPoints",
- "columnName": "proposed_points",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "finalPoints",
- "columnName": "final_points",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "pointsSum",
- "columnName": "points_sum",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "average",
- "columnName": "average",
- "affinity": "REAL",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "GradesStatistics",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `subject` TEXT NOT NULL, `grade` INTEGER NOT NULL, `amount` INTEGER NOT NULL, `is_semester` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "grade",
- "columnName": "grade",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "amount",
- "columnName": "amount",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semester",
- "columnName": "is_semester",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "GradesPointsStatistics",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `subject` TEXT NOT NULL, `others` REAL NOT NULL, `student` REAL NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "others",
- "columnName": "others",
- "affinity": "REAL",
- "notNull": true
- },
- {
- "fieldPath": "student",
- "columnName": "student",
- "affinity": "REAL",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Messages",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_notified` INTEGER NOT NULL, `unread_by` INTEGER NOT NULL, `read_by` INTEGER NOT NULL, `content` TEXT NOT NULL, `student_id` INTEGER NOT NULL, `real_id` INTEGER NOT NULL, `message_id` INTEGER NOT NULL, `sender_name` TEXT NOT NULL, `sender_id` INTEGER NOT NULL, `recipient_name` TEXT NOT NULL, `subject` TEXT NOT NULL, `date` INTEGER NOT NULL, `folder_id` INTEGER NOT NULL, `unread` INTEGER NOT NULL, `removed` INTEGER NOT NULL, `has_attachments` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isNotified",
- "columnName": "is_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "unreadBy",
- "columnName": "unread_by",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "readBy",
- "columnName": "read_by",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "content",
- "columnName": "content",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "realId",
- "columnName": "real_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "messageId",
- "columnName": "message_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "sender",
- "columnName": "sender_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "senderId",
- "columnName": "sender_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "recipient",
- "columnName": "recipient_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "folderId",
- "columnName": "folder_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "unread",
- "columnName": "unread",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "removed",
- "columnName": "removed",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "hasAttachments",
- "columnName": "has_attachments",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "MessageAttachments",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`real_id` INTEGER NOT NULL, `message_id` INTEGER NOT NULL, `one_drive_id` TEXT NOT NULL, `url` TEXT NOT NULL, `filename` TEXT NOT NULL, PRIMARY KEY(`real_id`))",
- "fields": [
- {
- "fieldPath": "realId",
- "columnName": "real_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "messageId",
- "columnName": "message_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "oneDriveId",
- "columnName": "one_drive_id",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "url",
- "columnName": "url",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "filename",
- "columnName": "filename",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "real_id"
- ],
- "autoGenerate": false
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Notes",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_read` INTEGER NOT NULL, `is_notified` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `teacher` TEXT NOT NULL, `teacher_symbol` TEXT NOT NULL, `category` TEXT NOT NULL, `category_type` INTEGER NOT NULL, `is_points_show` INTEGER NOT NULL, `points` INTEGER NOT NULL, `content` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isRead",
- "columnName": "is_read",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isNotified",
- "columnName": "is_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherSymbol",
- "columnName": "teacher_symbol",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "category",
- "columnName": "category",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "categoryType",
- "columnName": "category_type",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isPointsShow",
- "columnName": "is_points_show",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "points",
- "columnName": "points",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "content",
- "columnName": "content",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Homework",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_done` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `entry_date` INTEGER NOT NULL, `subject` TEXT NOT NULL, `content` TEXT NOT NULL, `teacher` TEXT NOT NULL, `teacher_symbol` TEXT NOT NULL, `attachments` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isDone",
- "columnName": "is_done",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "entryDate",
- "columnName": "entry_date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "content",
- "columnName": "content",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherSymbol",
- "columnName": "teacher_symbol",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "attachments",
- "columnName": "attachments",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Subjects",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `real_id` INTEGER NOT NULL, `name` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "realId",
- "columnName": "real_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "LuckyNumbers",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_notified` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `lucky_number` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isNotified",
- "columnName": "is_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "luckyNumber",
- "columnName": "lucky_number",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "CompletedLesson",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `number` INTEGER NOT NULL, `subject` TEXT NOT NULL, `topic` TEXT NOT NULL, `teacher` TEXT NOT NULL, `teacher_symbol` TEXT NOT NULL, `substitution` TEXT NOT NULL, `absence` TEXT NOT NULL, `resources` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "number",
- "columnName": "number",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "topic",
- "columnName": "topic",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherSymbol",
- "columnName": "teacher_symbol",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "substitution",
- "columnName": "substitution",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "absence",
- "columnName": "absence",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "resources",
- "columnName": "resources",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "ReportingUnits",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `real_id` INTEGER NOT NULL, `short` TEXT NOT NULL, `sender_id` INTEGER NOT NULL, `sender_name` TEXT NOT NULL, `roles` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "realId",
- "columnName": "real_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "shortName",
- "columnName": "short",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "senderId",
- "columnName": "sender_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "senderName",
- "columnName": "sender_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "roles",
- "columnName": "roles",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Recipients",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `real_id` TEXT NOT NULL, `name` TEXT NOT NULL, `real_name` TEXT NOT NULL, `login_id` INTEGER NOT NULL, `unit_id` INTEGER NOT NULL, `role` INTEGER NOT NULL, `hash` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "realId",
- "columnName": "real_id",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "realName",
- "columnName": "real_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "loginId",
- "columnName": "login_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "unitId",
- "columnName": "unit_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "role",
- "columnName": "role",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "hash",
- "columnName": "hash",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "MobileDevices",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `device_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `date` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "deviceId",
- "columnName": "device_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Teachers",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `class_id` INTEGER NOT NULL, `subject` TEXT NOT NULL, `name` TEXT NOT NULL, `short_name` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "classId",
- "columnName": "class_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "shortName",
- "columnName": "short_name",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "School",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `class_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `address` TEXT NOT NULL, `contact` TEXT NOT NULL, `headmaster` TEXT NOT NULL, `pedagogue` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "classId",
- "columnName": "class_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "address",
- "columnName": "address",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "contact",
- "columnName": "contact",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "headmaster",
- "columnName": "headmaster",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "pedagogue",
- "columnName": "pedagogue",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Conferences",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `title` TEXT NOT NULL, `subject` TEXT NOT NULL, `agenda` TEXT NOT NULL, `present_on_conference` TEXT NOT NULL, `conference_id` INTEGER NOT NULL, `date` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "title",
- "columnName": "title",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "agenda",
- "columnName": "agenda",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "presentOnConference",
- "columnName": "present_on_conference",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "conferenceId",
- "columnName": "conference_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- }
- ],
- "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, '3a449a55ea73fbfbb7973f1f3f834e10')"
- ]
- }
-}
\ No newline at end of file
diff --git a/app/schemas/io.github.wulkanowy.data.db.AppDatabase/29.json b/app/schemas/io.github.wulkanowy.data.db.AppDatabase/29.json
deleted file mode 100644
index 3e863c57..00000000
--- a/app/schemas/io.github.wulkanowy.data.db.AppDatabase/29.json
+++ /dev/null
@@ -1,1898 +0,0 @@
-{
- "formatVersion": 1,
- "database": {
- "version": 29,
- "identityHash": "30e4647c7dd84a6ac9b2f9f3ef7d3264",
- "entities": [
- {
- "tableName": "Students",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `scrapper_base_url` TEXT NOT NULL, `mobile_base_url` TEXT NOT NULL, `login_type` TEXT NOT NULL, `login_mode` TEXT NOT NULL, `certificate_key` TEXT NOT NULL, `private_key` TEXT NOT NULL, `is_parent` INTEGER NOT NULL, `email` TEXT NOT NULL, `password` TEXT NOT NULL, `symbol` TEXT NOT NULL, `student_id` INTEGER NOT NULL, `user_login_id` INTEGER NOT NULL, `user_name` TEXT NOT NULL, `student_name` TEXT NOT NULL, `school_id` TEXT NOT NULL, `school_short` TEXT NOT NULL, `school_name` TEXT NOT NULL, `class_name` TEXT NOT NULL, `class_id` INTEGER NOT NULL, `is_current` INTEGER NOT NULL, `registration_date` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "scrapperBaseUrl",
- "columnName": "scrapper_base_url",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "mobileBaseUrl",
- "columnName": "mobile_base_url",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "loginType",
- "columnName": "login_type",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "loginMode",
- "columnName": "login_mode",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "certificateKey",
- "columnName": "certificate_key",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "privateKey",
- "columnName": "private_key",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "isParent",
- "columnName": "is_parent",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "email",
- "columnName": "email",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "password",
- "columnName": "password",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "symbol",
- "columnName": "symbol",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "userLoginId",
- "columnName": "user_login_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "userName",
- "columnName": "user_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "studentName",
- "columnName": "student_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "schoolSymbol",
- "columnName": "school_id",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "schoolShortName",
- "columnName": "school_short",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "schoolName",
- "columnName": "school_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "className",
- "columnName": "class_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "classId",
- "columnName": "class_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isCurrent",
- "columnName": "is_current",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "registrationDate",
- "columnName": "registration_date",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [
- {
- "name": "index_Students_email_symbol_student_id_school_id_class_id",
- "unique": true,
- "columnNames": [
- "email",
- "symbol",
- "student_id",
- "school_id",
- "class_id"
- ],
- "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_Students_email_symbol_student_id_school_id_class_id` ON `${TABLE_NAME}` (`email`, `symbol`, `student_id`, `school_id`, `class_id`)"
- }
- ],
- "foreignKeys": []
- },
- {
- "tableName": "Semesters",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_current` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `diary_name` TEXT NOT NULL, `school_year` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `semester_name` INTEGER NOT NULL, `start` INTEGER NOT NULL, `end` INTEGER NOT NULL, `class_id` INTEGER NOT NULL, `unit_id` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "current",
- "columnName": "is_current",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryName",
- "columnName": "diary_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "schoolYear",
- "columnName": "school_year",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterName",
- "columnName": "semester_name",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "start",
- "columnName": "start",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "end",
- "columnName": "end",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "classId",
- "columnName": "class_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "unitId",
- "columnName": "unit_id",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [
- {
- "name": "index_Semesters_student_id_diary_id_semester_id",
- "unique": true,
- "columnNames": [
- "student_id",
- "diary_id",
- "semester_id"
- ],
- "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_Semesters_student_id_diary_id_semester_id` ON `${TABLE_NAME}` (`student_id`, `diary_id`, `semester_id`)"
- }
- ],
- "foreignKeys": []
- },
- {
- "tableName": "Exams",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `entry_date` INTEGER NOT NULL, `subject` TEXT NOT NULL, `group` TEXT NOT NULL, `type` TEXT NOT NULL, `description` TEXT NOT NULL, `teacher` TEXT NOT NULL, `teacher_symbol` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "entryDate",
- "columnName": "entry_date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "group",
- "columnName": "group",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "type",
- "columnName": "type",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "description",
- "columnName": "description",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherSymbol",
- "columnName": "teacher_symbol",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Timetable",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `number` INTEGER NOT NULL, `start` INTEGER NOT NULL, `end` INTEGER NOT NULL, `date` INTEGER NOT NULL, `subject` TEXT NOT NULL, `subjectOld` TEXT NOT NULL, `group` TEXT NOT NULL, `room` TEXT NOT NULL, `roomOld` TEXT NOT NULL, `teacher` TEXT NOT NULL, `teacherOld` TEXT NOT NULL, `info` TEXT NOT NULL, `student_plan` INTEGER NOT NULL, `changes` INTEGER NOT NULL, `canceled` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "number",
- "columnName": "number",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "start",
- "columnName": "start",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "end",
- "columnName": "end",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "subjectOld",
- "columnName": "subjectOld",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "group",
- "columnName": "group",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "room",
- "columnName": "room",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "roomOld",
- "columnName": "roomOld",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherOld",
- "columnName": "teacherOld",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "info",
- "columnName": "info",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "isStudentPlan",
- "columnName": "student_plan",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "changes",
- "columnName": "changes",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "canceled",
- "columnName": "canceled",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Attendance",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `time_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `number` INTEGER NOT NULL, `subject` TEXT NOT NULL, `name` TEXT NOT NULL, `presence` INTEGER NOT NULL, `absence` INTEGER NOT NULL, `exemption` INTEGER NOT NULL, `lateness` INTEGER NOT NULL, `excused` INTEGER NOT NULL, `deleted` INTEGER NOT NULL, `excusable` INTEGER NOT NULL, `excuse_status` TEXT)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "timeId",
- "columnName": "time_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "number",
- "columnName": "number",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "presence",
- "columnName": "presence",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "absence",
- "columnName": "absence",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "exemption",
- "columnName": "exemption",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "lateness",
- "columnName": "lateness",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "excused",
- "columnName": "excused",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "deleted",
- "columnName": "deleted",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "excusable",
- "columnName": "excusable",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "excuseStatus",
- "columnName": "excuse_status",
- "affinity": "TEXT",
- "notNull": false
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "AttendanceSummary",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `subject_id` INTEGER NOT NULL, `month` INTEGER NOT NULL, `presence` INTEGER NOT NULL, `absence` INTEGER NOT NULL, `absence_excused` INTEGER NOT NULL, `absence_for_school_reasons` INTEGER NOT NULL, `lateness` INTEGER NOT NULL, `lateness_excused` INTEGER NOT NULL, `exemption` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subjectId",
- "columnName": "subject_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "month",
- "columnName": "month",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "presence",
- "columnName": "presence",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "absence",
- "columnName": "absence",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "absenceExcused",
- "columnName": "absence_excused",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "absenceForSchoolReasons",
- "columnName": "absence_for_school_reasons",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "lateness",
- "columnName": "lateness",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "latenessExcused",
- "columnName": "lateness_excused",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "exemption",
- "columnName": "exemption",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Grades",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_read` INTEGER NOT NULL, `is_notified` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `subject` TEXT NOT NULL, `entry` TEXT NOT NULL, `value` REAL NOT NULL, `modifier` REAL NOT NULL, `comment` TEXT NOT NULL, `color` TEXT NOT NULL, `grade_symbol` TEXT NOT NULL, `description` TEXT NOT NULL, `weight` TEXT NOT NULL, `weightValue` REAL NOT NULL, `date` INTEGER NOT NULL, `teacher` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isRead",
- "columnName": "is_read",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isNotified",
- "columnName": "is_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "entry",
- "columnName": "entry",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "value",
- "columnName": "value",
- "affinity": "REAL",
- "notNull": true
- },
- {
- "fieldPath": "modifier",
- "columnName": "modifier",
- "affinity": "REAL",
- "notNull": true
- },
- {
- "fieldPath": "comment",
- "columnName": "comment",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "color",
- "columnName": "color",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "gradeSymbol",
- "columnName": "grade_symbol",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "description",
- "columnName": "description",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "weight",
- "columnName": "weight",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "weightValue",
- "columnName": "weightValue",
- "affinity": "REAL",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "GradesSummary",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_predicted_grade_notified` INTEGER NOT NULL, `is_final_grade_notified` INTEGER NOT NULL, `predicted_grade_last_change` INTEGER NOT NULL, `final_grade_last_change` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `position` INTEGER NOT NULL, `subject` TEXT NOT NULL, `predicted_grade` TEXT NOT NULL, `final_grade` TEXT NOT NULL, `proposed_points` TEXT NOT NULL, `final_points` TEXT NOT NULL, `points_sum` TEXT NOT NULL, `average` REAL NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isPredictedGradeNotified",
- "columnName": "is_predicted_grade_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isFinalGradeNotified",
- "columnName": "is_final_grade_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "predictedGradeLastChange",
- "columnName": "predicted_grade_last_change",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "finalGradeLastChange",
- "columnName": "final_grade_last_change",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "position",
- "columnName": "position",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "predictedGrade",
- "columnName": "predicted_grade",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "finalGrade",
- "columnName": "final_grade",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "proposedPoints",
- "columnName": "proposed_points",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "finalPoints",
- "columnName": "final_points",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "pointsSum",
- "columnName": "points_sum",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "average",
- "columnName": "average",
- "affinity": "REAL",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "GradePartialStatistics",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `subject` TEXT NOT NULL, `class_average` TEXT NOT NULL, `student_average` TEXT NOT NULL, `class_amounts` TEXT NOT NULL, `student_amounts` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "classAverage",
- "columnName": "class_average",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "studentAverage",
- "columnName": "student_average",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "classAmounts",
- "columnName": "class_amounts",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "studentAmounts",
- "columnName": "student_amounts",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "GradesPointsStatistics",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `subject` TEXT NOT NULL, `others` REAL NOT NULL, `student` REAL NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "others",
- "columnName": "others",
- "affinity": "REAL",
- "notNull": true
- },
- {
- "fieldPath": "student",
- "columnName": "student",
- "affinity": "REAL",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "GradeSemesterStatistics",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `subject` TEXT NOT NULL, `amounts` TEXT NOT NULL, `student_grade` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "amounts",
- "columnName": "amounts",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "studentGrade",
- "columnName": "student_grade",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Messages",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_notified` INTEGER NOT NULL, `unread_by` INTEGER NOT NULL, `read_by` INTEGER NOT NULL, `content` TEXT NOT NULL, `student_id` INTEGER NOT NULL, `real_id` INTEGER NOT NULL, `message_id` INTEGER NOT NULL, `sender_name` TEXT NOT NULL, `sender_id` INTEGER NOT NULL, `recipient_name` TEXT NOT NULL, `subject` TEXT NOT NULL, `date` INTEGER NOT NULL, `folder_id` INTEGER NOT NULL, `unread` INTEGER NOT NULL, `removed` INTEGER NOT NULL, `has_attachments` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isNotified",
- "columnName": "is_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "unreadBy",
- "columnName": "unread_by",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "readBy",
- "columnName": "read_by",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "content",
- "columnName": "content",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "realId",
- "columnName": "real_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "messageId",
- "columnName": "message_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "sender",
- "columnName": "sender_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "senderId",
- "columnName": "sender_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "recipient",
- "columnName": "recipient_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "folderId",
- "columnName": "folder_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "unread",
- "columnName": "unread",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "removed",
- "columnName": "removed",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "hasAttachments",
- "columnName": "has_attachments",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "MessageAttachments",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`real_id` INTEGER NOT NULL, `message_id` INTEGER NOT NULL, `one_drive_id` TEXT NOT NULL, `url` TEXT NOT NULL, `filename` TEXT NOT NULL, PRIMARY KEY(`real_id`))",
- "fields": [
- {
- "fieldPath": "realId",
- "columnName": "real_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "messageId",
- "columnName": "message_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "oneDriveId",
- "columnName": "one_drive_id",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "url",
- "columnName": "url",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "filename",
- "columnName": "filename",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "real_id"
- ],
- "autoGenerate": false
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Notes",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_read` INTEGER NOT NULL, `is_notified` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `teacher` TEXT NOT NULL, `teacher_symbol` TEXT NOT NULL, `category` TEXT NOT NULL, `category_type` INTEGER NOT NULL, `is_points_show` INTEGER NOT NULL, `points` INTEGER NOT NULL, `content` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isRead",
- "columnName": "is_read",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isNotified",
- "columnName": "is_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherSymbol",
- "columnName": "teacher_symbol",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "category",
- "columnName": "category",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "categoryType",
- "columnName": "category_type",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isPointsShow",
- "columnName": "is_points_show",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "points",
- "columnName": "points",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "content",
- "columnName": "content",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Homework",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_done` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `entry_date` INTEGER NOT NULL, `subject` TEXT NOT NULL, `content` TEXT NOT NULL, `teacher` TEXT NOT NULL, `teacher_symbol` TEXT NOT NULL, `attachments` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isDone",
- "columnName": "is_done",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "entryDate",
- "columnName": "entry_date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "content",
- "columnName": "content",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherSymbol",
- "columnName": "teacher_symbol",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "attachments",
- "columnName": "attachments",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Subjects",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `real_id` INTEGER NOT NULL, `name` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "realId",
- "columnName": "real_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "LuckyNumbers",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_notified` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `lucky_number` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isNotified",
- "columnName": "is_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "luckyNumber",
- "columnName": "lucky_number",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "CompletedLesson",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `number` INTEGER NOT NULL, `subject` TEXT NOT NULL, `topic` TEXT NOT NULL, `teacher` TEXT NOT NULL, `teacher_symbol` TEXT NOT NULL, `substitution` TEXT NOT NULL, `absence` TEXT NOT NULL, `resources` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "number",
- "columnName": "number",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "topic",
- "columnName": "topic",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherSymbol",
- "columnName": "teacher_symbol",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "substitution",
- "columnName": "substitution",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "absence",
- "columnName": "absence",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "resources",
- "columnName": "resources",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "ReportingUnits",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `real_id` INTEGER NOT NULL, `short` TEXT NOT NULL, `sender_id` INTEGER NOT NULL, `sender_name` TEXT NOT NULL, `roles` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "realId",
- "columnName": "real_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "shortName",
- "columnName": "short",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "senderId",
- "columnName": "sender_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "senderName",
- "columnName": "sender_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "roles",
- "columnName": "roles",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Recipients",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `real_id` TEXT NOT NULL, `name` TEXT NOT NULL, `real_name` TEXT NOT NULL, `login_id` INTEGER NOT NULL, `unit_id` INTEGER NOT NULL, `role` INTEGER NOT NULL, `hash` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "realId",
- "columnName": "real_id",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "realName",
- "columnName": "real_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "loginId",
- "columnName": "login_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "unitId",
- "columnName": "unit_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "role",
- "columnName": "role",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "hash",
- "columnName": "hash",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "MobileDevices",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `device_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `date` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "deviceId",
- "columnName": "device_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Teachers",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `class_id` INTEGER NOT NULL, `subject` TEXT NOT NULL, `name` TEXT NOT NULL, `short_name` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "classId",
- "columnName": "class_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "shortName",
- "columnName": "short_name",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "School",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `class_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `address` TEXT NOT NULL, `contact` TEXT NOT NULL, `headmaster` TEXT NOT NULL, `pedagogue` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "classId",
- "columnName": "class_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "address",
- "columnName": "address",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "contact",
- "columnName": "contact",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "headmaster",
- "columnName": "headmaster",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "pedagogue",
- "columnName": "pedagogue",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Conferences",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `title` TEXT NOT NULL, `subject` TEXT NOT NULL, `agenda` TEXT NOT NULL, `present_on_conference` TEXT NOT NULL, `conference_id` INTEGER NOT NULL, `date` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "title",
- "columnName": "title",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "agenda",
- "columnName": "agenda",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "presentOnConference",
- "columnName": "present_on_conference",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "conferenceId",
- "columnName": "conference_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- }
- ],
- "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, '30e4647c7dd84a6ac9b2f9f3ef7d3264')"
- ]
- }
-}
\ No newline at end of file
diff --git a/app/schemas/io.github.wulkanowy.data.db.AppDatabase/30.json b/app/schemas/io.github.wulkanowy.data.db.AppDatabase/30.json
deleted file mode 100644
index 309f4ac0..00000000
--- a/app/schemas/io.github.wulkanowy.data.db.AppDatabase/30.json
+++ /dev/null
@@ -1,1954 +0,0 @@
-{
- "formatVersion": 1,
- "database": {
- "version": 30,
- "identityHash": "891980e378373d0a17bd341f9b07cc74",
- "entities": [
- {
- "tableName": "Students",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `scrapper_base_url` TEXT NOT NULL, `mobile_base_url` TEXT NOT NULL, `login_type` TEXT NOT NULL, `login_mode` TEXT NOT NULL, `certificate_key` TEXT NOT NULL, `private_key` TEXT NOT NULL, `is_parent` INTEGER NOT NULL, `email` TEXT NOT NULL, `password` TEXT NOT NULL, `symbol` TEXT NOT NULL, `student_id` INTEGER NOT NULL, `user_login_id` INTEGER NOT NULL, `user_name` TEXT NOT NULL, `student_name` TEXT NOT NULL, `school_id` TEXT NOT NULL, `school_short` TEXT NOT NULL, `school_name` TEXT NOT NULL, `class_name` TEXT NOT NULL, `class_id` INTEGER NOT NULL, `is_current` INTEGER NOT NULL, `registration_date` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "scrapperBaseUrl",
- "columnName": "scrapper_base_url",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "mobileBaseUrl",
- "columnName": "mobile_base_url",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "loginType",
- "columnName": "login_type",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "loginMode",
- "columnName": "login_mode",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "certificateKey",
- "columnName": "certificate_key",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "privateKey",
- "columnName": "private_key",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "isParent",
- "columnName": "is_parent",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "email",
- "columnName": "email",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "password",
- "columnName": "password",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "symbol",
- "columnName": "symbol",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "userLoginId",
- "columnName": "user_login_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "userName",
- "columnName": "user_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "studentName",
- "columnName": "student_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "schoolSymbol",
- "columnName": "school_id",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "schoolShortName",
- "columnName": "school_short",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "schoolName",
- "columnName": "school_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "className",
- "columnName": "class_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "classId",
- "columnName": "class_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isCurrent",
- "columnName": "is_current",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "registrationDate",
- "columnName": "registration_date",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [
- {
- "name": "index_Students_email_symbol_student_id_school_id_class_id",
- "unique": true,
- "columnNames": [
- "email",
- "symbol",
- "student_id",
- "school_id",
- "class_id"
- ],
- "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_Students_email_symbol_student_id_school_id_class_id` ON `${TABLE_NAME}` (`email`, `symbol`, `student_id`, `school_id`, `class_id`)"
- }
- ],
- "foreignKeys": []
- },
- {
- "tableName": "Semesters",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_current` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `diary_name` TEXT NOT NULL, `school_year` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `semester_name` INTEGER NOT NULL, `start` INTEGER NOT NULL, `end` INTEGER NOT NULL, `class_id` INTEGER NOT NULL, `unit_id` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "current",
- "columnName": "is_current",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryName",
- "columnName": "diary_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "schoolYear",
- "columnName": "school_year",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterName",
- "columnName": "semester_name",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "start",
- "columnName": "start",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "end",
- "columnName": "end",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "classId",
- "columnName": "class_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "unitId",
- "columnName": "unit_id",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [
- {
- "name": "index_Semesters_student_id_diary_id_semester_id",
- "unique": true,
- "columnNames": [
- "student_id",
- "diary_id",
- "semester_id"
- ],
- "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_Semesters_student_id_diary_id_semester_id` ON `${TABLE_NAME}` (`student_id`, `diary_id`, `semester_id`)"
- }
- ],
- "foreignKeys": []
- },
- {
- "tableName": "Exams",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `entry_date` INTEGER NOT NULL, `subject` TEXT NOT NULL, `group` TEXT NOT NULL, `type` TEXT NOT NULL, `description` TEXT NOT NULL, `teacher` TEXT NOT NULL, `teacher_symbol` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "entryDate",
- "columnName": "entry_date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "group",
- "columnName": "group",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "type",
- "columnName": "type",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "description",
- "columnName": "description",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherSymbol",
- "columnName": "teacher_symbol",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Timetable",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `number` INTEGER NOT NULL, `start` INTEGER NOT NULL, `end` INTEGER NOT NULL, `date` INTEGER NOT NULL, `subject` TEXT NOT NULL, `subjectOld` TEXT NOT NULL, `group` TEXT NOT NULL, `room` TEXT NOT NULL, `roomOld` TEXT NOT NULL, `teacher` TEXT NOT NULL, `teacherOld` TEXT NOT NULL, `info` TEXT NOT NULL, `student_plan` INTEGER NOT NULL, `changes` INTEGER NOT NULL, `canceled` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "number",
- "columnName": "number",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "start",
- "columnName": "start",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "end",
- "columnName": "end",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "subjectOld",
- "columnName": "subjectOld",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "group",
- "columnName": "group",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "room",
- "columnName": "room",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "roomOld",
- "columnName": "roomOld",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherOld",
- "columnName": "teacherOld",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "info",
- "columnName": "info",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "isStudentPlan",
- "columnName": "student_plan",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "changes",
- "columnName": "changes",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "canceled",
- "columnName": "canceled",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Attendance",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `time_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `number` INTEGER NOT NULL, `subject` TEXT NOT NULL, `name` TEXT NOT NULL, `presence` INTEGER NOT NULL, `absence` INTEGER NOT NULL, `exemption` INTEGER NOT NULL, `lateness` INTEGER NOT NULL, `excused` INTEGER NOT NULL, `deleted` INTEGER NOT NULL, `excusable` INTEGER NOT NULL, `excuse_status` TEXT)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "timeId",
- "columnName": "time_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "number",
- "columnName": "number",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "presence",
- "columnName": "presence",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "absence",
- "columnName": "absence",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "exemption",
- "columnName": "exemption",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "lateness",
- "columnName": "lateness",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "excused",
- "columnName": "excused",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "deleted",
- "columnName": "deleted",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "excusable",
- "columnName": "excusable",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "excuseStatus",
- "columnName": "excuse_status",
- "affinity": "TEXT",
- "notNull": false
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "AttendanceSummary",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `subject_id` INTEGER NOT NULL, `month` INTEGER NOT NULL, `presence` INTEGER NOT NULL, `absence` INTEGER NOT NULL, `absence_excused` INTEGER NOT NULL, `absence_for_school_reasons` INTEGER NOT NULL, `lateness` INTEGER NOT NULL, `lateness_excused` INTEGER NOT NULL, `exemption` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subjectId",
- "columnName": "subject_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "month",
- "columnName": "month",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "presence",
- "columnName": "presence",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "absence",
- "columnName": "absence",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "absenceExcused",
- "columnName": "absence_excused",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "absenceForSchoolReasons",
- "columnName": "absence_for_school_reasons",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "lateness",
- "columnName": "lateness",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "latenessExcused",
- "columnName": "lateness_excused",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "exemption",
- "columnName": "exemption",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Grades",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_read` INTEGER NOT NULL, `is_notified` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `subject` TEXT NOT NULL, `entry` TEXT NOT NULL, `value` REAL NOT NULL, `modifier` REAL NOT NULL, `comment` TEXT NOT NULL, `color` TEXT NOT NULL, `grade_symbol` TEXT NOT NULL, `description` TEXT NOT NULL, `weight` TEXT NOT NULL, `weightValue` REAL NOT NULL, `date` INTEGER NOT NULL, `teacher` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isRead",
- "columnName": "is_read",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isNotified",
- "columnName": "is_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "entry",
- "columnName": "entry",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "value",
- "columnName": "value",
- "affinity": "REAL",
- "notNull": true
- },
- {
- "fieldPath": "modifier",
- "columnName": "modifier",
- "affinity": "REAL",
- "notNull": true
- },
- {
- "fieldPath": "comment",
- "columnName": "comment",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "color",
- "columnName": "color",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "gradeSymbol",
- "columnName": "grade_symbol",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "description",
- "columnName": "description",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "weight",
- "columnName": "weight",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "weightValue",
- "columnName": "weightValue",
- "affinity": "REAL",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "GradesSummary",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_predicted_grade_notified` INTEGER NOT NULL, `is_final_grade_notified` INTEGER NOT NULL, `predicted_grade_last_change` INTEGER NOT NULL, `final_grade_last_change` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `position` INTEGER NOT NULL, `subject` TEXT NOT NULL, `predicted_grade` TEXT NOT NULL, `final_grade` TEXT NOT NULL, `proposed_points` TEXT NOT NULL, `final_points` TEXT NOT NULL, `points_sum` TEXT NOT NULL, `average` REAL NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isPredictedGradeNotified",
- "columnName": "is_predicted_grade_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isFinalGradeNotified",
- "columnName": "is_final_grade_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "predictedGradeLastChange",
- "columnName": "predicted_grade_last_change",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "finalGradeLastChange",
- "columnName": "final_grade_last_change",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "position",
- "columnName": "position",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "predictedGrade",
- "columnName": "predicted_grade",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "finalGrade",
- "columnName": "final_grade",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "proposedPoints",
- "columnName": "proposed_points",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "finalPoints",
- "columnName": "final_points",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "pointsSum",
- "columnName": "points_sum",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "average",
- "columnName": "average",
- "affinity": "REAL",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "GradePartialStatistics",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `subject` TEXT NOT NULL, `class_average` TEXT NOT NULL, `student_average` TEXT NOT NULL, `class_amounts` TEXT NOT NULL, `student_amounts` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "classAverage",
- "columnName": "class_average",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "studentAverage",
- "columnName": "student_average",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "classAmounts",
- "columnName": "class_amounts",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "studentAmounts",
- "columnName": "student_amounts",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "GradesPointsStatistics",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `subject` TEXT NOT NULL, `others` REAL NOT NULL, `student` REAL NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "others",
- "columnName": "others",
- "affinity": "REAL",
- "notNull": true
- },
- {
- "fieldPath": "student",
- "columnName": "student",
- "affinity": "REAL",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "GradeSemesterStatistics",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `subject` TEXT NOT NULL, `amounts` TEXT NOT NULL, `student_grade` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "amounts",
- "columnName": "amounts",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "studentGrade",
- "columnName": "student_grade",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Messages",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_notified` INTEGER NOT NULL, `unread_by` INTEGER NOT NULL, `read_by` INTEGER NOT NULL, `content` TEXT NOT NULL, `student_id` INTEGER NOT NULL, `real_id` INTEGER NOT NULL, `message_id` INTEGER NOT NULL, `sender_name` TEXT NOT NULL, `sender_id` INTEGER NOT NULL, `recipient_name` TEXT NOT NULL, `subject` TEXT NOT NULL, `date` INTEGER NOT NULL, `folder_id` INTEGER NOT NULL, `unread` INTEGER NOT NULL, `removed` INTEGER NOT NULL, `has_attachments` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isNotified",
- "columnName": "is_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "unreadBy",
- "columnName": "unread_by",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "readBy",
- "columnName": "read_by",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "content",
- "columnName": "content",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "realId",
- "columnName": "real_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "messageId",
- "columnName": "message_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "sender",
- "columnName": "sender_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "senderId",
- "columnName": "sender_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "recipient",
- "columnName": "recipient_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "folderId",
- "columnName": "folder_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "unread",
- "columnName": "unread",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "removed",
- "columnName": "removed",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "hasAttachments",
- "columnName": "has_attachments",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "MessageAttachments",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`real_id` INTEGER NOT NULL, `message_id` INTEGER NOT NULL, `one_drive_id` TEXT NOT NULL, `url` TEXT NOT NULL, `filename` TEXT NOT NULL, PRIMARY KEY(`real_id`))",
- "fields": [
- {
- "fieldPath": "realId",
- "columnName": "real_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "messageId",
- "columnName": "message_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "oneDriveId",
- "columnName": "one_drive_id",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "url",
- "columnName": "url",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "filename",
- "columnName": "filename",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "real_id"
- ],
- "autoGenerate": false
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Notes",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_read` INTEGER NOT NULL, `is_notified` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `teacher` TEXT NOT NULL, `teacher_symbol` TEXT NOT NULL, `category` TEXT NOT NULL, `category_type` INTEGER NOT NULL, `is_points_show` INTEGER NOT NULL, `points` INTEGER NOT NULL, `content` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isRead",
- "columnName": "is_read",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isNotified",
- "columnName": "is_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherSymbol",
- "columnName": "teacher_symbol",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "category",
- "columnName": "category",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "categoryType",
- "columnName": "category_type",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isPointsShow",
- "columnName": "is_points_show",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "points",
- "columnName": "points",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "content",
- "columnName": "content",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Homework",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_done` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `entry_date` INTEGER NOT NULL, `subject` TEXT NOT NULL, `content` TEXT NOT NULL, `teacher` TEXT NOT NULL, `teacher_symbol` TEXT NOT NULL, `attachments` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isDone",
- "columnName": "is_done",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "entryDate",
- "columnName": "entry_date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "content",
- "columnName": "content",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherSymbol",
- "columnName": "teacher_symbol",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "attachments",
- "columnName": "attachments",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Subjects",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `real_id` INTEGER NOT NULL, `name` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "realId",
- "columnName": "real_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "LuckyNumbers",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_notified` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `lucky_number` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isNotified",
- "columnName": "is_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "luckyNumber",
- "columnName": "lucky_number",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "CompletedLesson",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `number` INTEGER NOT NULL, `subject` TEXT NOT NULL, `topic` TEXT NOT NULL, `teacher` TEXT NOT NULL, `teacher_symbol` TEXT NOT NULL, `substitution` TEXT NOT NULL, `absence` TEXT NOT NULL, `resources` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "number",
- "columnName": "number",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "topic",
- "columnName": "topic",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherSymbol",
- "columnName": "teacher_symbol",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "substitution",
- "columnName": "substitution",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "absence",
- "columnName": "absence",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "resources",
- "columnName": "resources",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "ReportingUnits",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `real_id` INTEGER NOT NULL, `short` TEXT NOT NULL, `sender_id` INTEGER NOT NULL, `sender_name` TEXT NOT NULL, `roles` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "realId",
- "columnName": "real_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "shortName",
- "columnName": "short",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "senderId",
- "columnName": "sender_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "senderName",
- "columnName": "sender_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "roles",
- "columnName": "roles",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Recipients",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `real_id` TEXT NOT NULL, `name` TEXT NOT NULL, `real_name` TEXT NOT NULL, `login_id` INTEGER NOT NULL, `unit_id` INTEGER NOT NULL, `role` INTEGER NOT NULL, `hash` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "realId",
- "columnName": "real_id",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "realName",
- "columnName": "real_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "loginId",
- "columnName": "login_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "unitId",
- "columnName": "unit_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "role",
- "columnName": "role",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "hash",
- "columnName": "hash",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "MobileDevices",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `device_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `date` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "deviceId",
- "columnName": "device_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Teachers",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `class_id` INTEGER NOT NULL, `subject` TEXT NOT NULL, `name` TEXT NOT NULL, `short_name` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "classId",
- "columnName": "class_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "shortName",
- "columnName": "short_name",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "School",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `class_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `address` TEXT NOT NULL, `contact` TEXT NOT NULL, `headmaster` TEXT NOT NULL, `pedagogue` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "classId",
- "columnName": "class_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "address",
- "columnName": "address",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "contact",
- "columnName": "contact",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "headmaster",
- "columnName": "headmaster",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "pedagogue",
- "columnName": "pedagogue",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Conferences",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `title` TEXT NOT NULL, `subject` TEXT NOT NULL, `agenda` TEXT NOT NULL, `present_on_conference` TEXT NOT NULL, `conference_id` INTEGER NOT NULL, `date` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "title",
- "columnName": "title",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "agenda",
- "columnName": "agenda",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "presentOnConference",
- "columnName": "present_on_conference",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "conferenceId",
- "columnName": "conference_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "TimetableAdditional",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `start` INTEGER NOT NULL, `end` INTEGER NOT NULL, `date` INTEGER NOT NULL, `subject` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "start",
- "columnName": "start",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "end",
- "columnName": "end",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- }
- ],
- "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, '891980e378373d0a17bd341f9b07cc74')"
- ]
- }
-}
\ No newline at end of file
diff --git a/app/schemas/io.github.wulkanowy.data.db.AppDatabase/31.json b/app/schemas/io.github.wulkanowy.data.db.AppDatabase/31.json
deleted file mode 100644
index 4935a901..00000000
--- a/app/schemas/io.github.wulkanowy.data.db.AppDatabase/31.json
+++ /dev/null
@@ -1,2136 +0,0 @@
-{
- "formatVersion": 1,
- "database": {
- "version": 31,
- "identityHash": "d642512ffa5fe81ae9308c9c55612539",
- "entities": [
- {
- "tableName": "Students",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `scrapper_base_url` TEXT NOT NULL, `mobile_base_url` TEXT NOT NULL, `login_type` TEXT NOT NULL, `login_mode` TEXT NOT NULL, `certificate_key` TEXT NOT NULL, `private_key` TEXT NOT NULL, `is_parent` INTEGER NOT NULL, `email` TEXT NOT NULL, `password` TEXT NOT NULL, `symbol` TEXT NOT NULL, `student_id` INTEGER NOT NULL, `user_login_id` INTEGER NOT NULL, `user_name` TEXT NOT NULL, `student_name` TEXT NOT NULL, `school_id` TEXT NOT NULL, `school_short` TEXT NOT NULL, `school_name` TEXT NOT NULL, `class_name` TEXT NOT NULL, `class_id` INTEGER NOT NULL, `is_current` INTEGER NOT NULL, `registration_date` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "scrapperBaseUrl",
- "columnName": "scrapper_base_url",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "mobileBaseUrl",
- "columnName": "mobile_base_url",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "loginType",
- "columnName": "login_type",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "loginMode",
- "columnName": "login_mode",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "certificateKey",
- "columnName": "certificate_key",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "privateKey",
- "columnName": "private_key",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "isParent",
- "columnName": "is_parent",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "email",
- "columnName": "email",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "password",
- "columnName": "password",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "symbol",
- "columnName": "symbol",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "userLoginId",
- "columnName": "user_login_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "userName",
- "columnName": "user_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "studentName",
- "columnName": "student_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "schoolSymbol",
- "columnName": "school_id",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "schoolShortName",
- "columnName": "school_short",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "schoolName",
- "columnName": "school_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "className",
- "columnName": "class_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "classId",
- "columnName": "class_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isCurrent",
- "columnName": "is_current",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "registrationDate",
- "columnName": "registration_date",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [
- {
- "name": "index_Students_email_symbol_student_id_school_id_class_id",
- "unique": true,
- "columnNames": [
- "email",
- "symbol",
- "student_id",
- "school_id",
- "class_id"
- ],
- "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_Students_email_symbol_student_id_school_id_class_id` ON `${TABLE_NAME}` (`email`, `symbol`, `student_id`, `school_id`, `class_id`)"
- }
- ],
- "foreignKeys": []
- },
- {
- "tableName": "Semesters",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_current` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `diary_name` TEXT NOT NULL, `school_year` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `semester_name` INTEGER NOT NULL, `start` INTEGER NOT NULL, `end` INTEGER NOT NULL, `class_id` INTEGER NOT NULL, `unit_id` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "current",
- "columnName": "is_current",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryName",
- "columnName": "diary_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "schoolYear",
- "columnName": "school_year",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterName",
- "columnName": "semester_name",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "start",
- "columnName": "start",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "end",
- "columnName": "end",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "classId",
- "columnName": "class_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "unitId",
- "columnName": "unit_id",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [
- {
- "name": "index_Semesters_student_id_diary_id_semester_id",
- "unique": true,
- "columnNames": [
- "student_id",
- "diary_id",
- "semester_id"
- ],
- "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_Semesters_student_id_diary_id_semester_id` ON `${TABLE_NAME}` (`student_id`, `diary_id`, `semester_id`)"
- }
- ],
- "foreignKeys": []
- },
- {
- "tableName": "Exams",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `entry_date` INTEGER NOT NULL, `subject` TEXT NOT NULL, `group` TEXT NOT NULL, `type` TEXT NOT NULL, `description` TEXT NOT NULL, `teacher` TEXT NOT NULL, `teacher_symbol` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "entryDate",
- "columnName": "entry_date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "group",
- "columnName": "group",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "type",
- "columnName": "type",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "description",
- "columnName": "description",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherSymbol",
- "columnName": "teacher_symbol",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Timetable",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `number` INTEGER NOT NULL, `start` INTEGER NOT NULL, `end` INTEGER NOT NULL, `date` INTEGER NOT NULL, `subject` TEXT NOT NULL, `subjectOld` TEXT NOT NULL, `group` TEXT NOT NULL, `room` TEXT NOT NULL, `roomOld` TEXT NOT NULL, `teacher` TEXT NOT NULL, `teacherOld` TEXT NOT NULL, `info` TEXT NOT NULL, `student_plan` INTEGER NOT NULL, `changes` INTEGER NOT NULL, `canceled` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "number",
- "columnName": "number",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "start",
- "columnName": "start",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "end",
- "columnName": "end",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "subjectOld",
- "columnName": "subjectOld",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "group",
- "columnName": "group",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "room",
- "columnName": "room",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "roomOld",
- "columnName": "roomOld",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherOld",
- "columnName": "teacherOld",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "info",
- "columnName": "info",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "isStudentPlan",
- "columnName": "student_plan",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "changes",
- "columnName": "changes",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "canceled",
- "columnName": "canceled",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Attendance",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `time_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `number` INTEGER NOT NULL, `subject` TEXT NOT NULL, `name` TEXT NOT NULL, `presence` INTEGER NOT NULL, `absence` INTEGER NOT NULL, `exemption` INTEGER NOT NULL, `lateness` INTEGER NOT NULL, `excused` INTEGER NOT NULL, `deleted` INTEGER NOT NULL, `excusable` INTEGER NOT NULL, `excuse_status` TEXT)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "timeId",
- "columnName": "time_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "number",
- "columnName": "number",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "presence",
- "columnName": "presence",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "absence",
- "columnName": "absence",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "exemption",
- "columnName": "exemption",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "lateness",
- "columnName": "lateness",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "excused",
- "columnName": "excused",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "deleted",
- "columnName": "deleted",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "excusable",
- "columnName": "excusable",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "excuseStatus",
- "columnName": "excuse_status",
- "affinity": "TEXT",
- "notNull": false
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "AttendanceSummary",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `subject_id` INTEGER NOT NULL, `month` INTEGER NOT NULL, `presence` INTEGER NOT NULL, `absence` INTEGER NOT NULL, `absence_excused` INTEGER NOT NULL, `absence_for_school_reasons` INTEGER NOT NULL, `lateness` INTEGER NOT NULL, `lateness_excused` INTEGER NOT NULL, `exemption` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subjectId",
- "columnName": "subject_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "month",
- "columnName": "month",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "presence",
- "columnName": "presence",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "absence",
- "columnName": "absence",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "absenceExcused",
- "columnName": "absence_excused",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "absenceForSchoolReasons",
- "columnName": "absence_for_school_reasons",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "lateness",
- "columnName": "lateness",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "latenessExcused",
- "columnName": "lateness_excused",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "exemption",
- "columnName": "exemption",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Grades",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_read` INTEGER NOT NULL, `is_notified` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `subject` TEXT NOT NULL, `entry` TEXT NOT NULL, `value` REAL NOT NULL, `modifier` REAL NOT NULL, `comment` TEXT NOT NULL, `color` TEXT NOT NULL, `grade_symbol` TEXT NOT NULL, `description` TEXT NOT NULL, `weight` TEXT NOT NULL, `weightValue` REAL NOT NULL, `date` INTEGER NOT NULL, `teacher` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isRead",
- "columnName": "is_read",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isNotified",
- "columnName": "is_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "entry",
- "columnName": "entry",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "value",
- "columnName": "value",
- "affinity": "REAL",
- "notNull": true
- },
- {
- "fieldPath": "modifier",
- "columnName": "modifier",
- "affinity": "REAL",
- "notNull": true
- },
- {
- "fieldPath": "comment",
- "columnName": "comment",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "color",
- "columnName": "color",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "gradeSymbol",
- "columnName": "grade_symbol",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "description",
- "columnName": "description",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "weight",
- "columnName": "weight",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "weightValue",
- "columnName": "weightValue",
- "affinity": "REAL",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "GradesSummary",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_predicted_grade_notified` INTEGER NOT NULL, `is_final_grade_notified` INTEGER NOT NULL, `predicted_grade_last_change` INTEGER NOT NULL, `final_grade_last_change` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `position` INTEGER NOT NULL, `subject` TEXT NOT NULL, `predicted_grade` TEXT NOT NULL, `final_grade` TEXT NOT NULL, `proposed_points` TEXT NOT NULL, `final_points` TEXT NOT NULL, `points_sum` TEXT NOT NULL, `average` REAL NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isPredictedGradeNotified",
- "columnName": "is_predicted_grade_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isFinalGradeNotified",
- "columnName": "is_final_grade_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "predictedGradeLastChange",
- "columnName": "predicted_grade_last_change",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "finalGradeLastChange",
- "columnName": "final_grade_last_change",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "position",
- "columnName": "position",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "predictedGrade",
- "columnName": "predicted_grade",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "finalGrade",
- "columnName": "final_grade",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "proposedPoints",
- "columnName": "proposed_points",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "finalPoints",
- "columnName": "final_points",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "pointsSum",
- "columnName": "points_sum",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "average",
- "columnName": "average",
- "affinity": "REAL",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "GradePartialStatistics",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `subject` TEXT NOT NULL, `class_average` TEXT NOT NULL, `student_average` TEXT NOT NULL, `class_amounts` TEXT NOT NULL, `student_amounts` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "classAverage",
- "columnName": "class_average",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "studentAverage",
- "columnName": "student_average",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "classAmounts",
- "columnName": "class_amounts",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "studentAmounts",
- "columnName": "student_amounts",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "GradesPointsStatistics",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `subject` TEXT NOT NULL, `others` REAL NOT NULL, `student` REAL NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "others",
- "columnName": "others",
- "affinity": "REAL",
- "notNull": true
- },
- {
- "fieldPath": "student",
- "columnName": "student",
- "affinity": "REAL",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "GradeSemesterStatistics",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `subject` TEXT NOT NULL, `amounts` TEXT NOT NULL, `student_grade` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "amounts",
- "columnName": "amounts",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "studentGrade",
- "columnName": "student_grade",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Messages",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_notified` INTEGER NOT NULL, `unread_by` INTEGER NOT NULL, `read_by` INTEGER NOT NULL, `content` TEXT NOT NULL, `student_id` INTEGER NOT NULL, `real_id` INTEGER NOT NULL, `message_id` INTEGER NOT NULL, `sender_name` TEXT NOT NULL, `sender_id` INTEGER NOT NULL, `recipient_name` TEXT NOT NULL, `subject` TEXT NOT NULL, `date` INTEGER NOT NULL, `folder_id` INTEGER NOT NULL, `unread` INTEGER NOT NULL, `removed` INTEGER NOT NULL, `has_attachments` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isNotified",
- "columnName": "is_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "unreadBy",
- "columnName": "unread_by",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "readBy",
- "columnName": "read_by",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "content",
- "columnName": "content",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "realId",
- "columnName": "real_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "messageId",
- "columnName": "message_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "sender",
- "columnName": "sender_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "senderId",
- "columnName": "sender_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "recipient",
- "columnName": "recipient_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "folderId",
- "columnName": "folder_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "unread",
- "columnName": "unread",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "removed",
- "columnName": "removed",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "hasAttachments",
- "columnName": "has_attachments",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "MessageAttachments",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`real_id` INTEGER NOT NULL, `message_id` INTEGER NOT NULL, `one_drive_id` TEXT NOT NULL, `url` TEXT NOT NULL, `filename` TEXT NOT NULL, PRIMARY KEY(`real_id`))",
- "fields": [
- {
- "fieldPath": "realId",
- "columnName": "real_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "messageId",
- "columnName": "message_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "oneDriveId",
- "columnName": "one_drive_id",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "url",
- "columnName": "url",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "filename",
- "columnName": "filename",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "real_id"
- ],
- "autoGenerate": false
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Notes",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_read` INTEGER NOT NULL, `is_notified` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `teacher` TEXT NOT NULL, `teacher_symbol` TEXT NOT NULL, `category` TEXT NOT NULL, `category_type` INTEGER NOT NULL, `is_points_show` INTEGER NOT NULL, `points` INTEGER NOT NULL, `content` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isRead",
- "columnName": "is_read",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isNotified",
- "columnName": "is_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherSymbol",
- "columnName": "teacher_symbol",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "category",
- "columnName": "category",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "categoryType",
- "columnName": "category_type",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isPointsShow",
- "columnName": "is_points_show",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "points",
- "columnName": "points",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "content",
- "columnName": "content",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Homework",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_done` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `entry_date` INTEGER NOT NULL, `subject` TEXT NOT NULL, `content` TEXT NOT NULL, `teacher` TEXT NOT NULL, `teacher_symbol` TEXT NOT NULL, `attachments` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isDone",
- "columnName": "is_done",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "entryDate",
- "columnName": "entry_date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "content",
- "columnName": "content",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherSymbol",
- "columnName": "teacher_symbol",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "attachments",
- "columnName": "attachments",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Subjects",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `real_id` INTEGER NOT NULL, `name` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "realId",
- "columnName": "real_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "LuckyNumbers",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_notified` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `lucky_number` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isNotified",
- "columnName": "is_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "luckyNumber",
- "columnName": "lucky_number",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "CompletedLesson",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `number` INTEGER NOT NULL, `subject` TEXT NOT NULL, `topic` TEXT NOT NULL, `teacher` TEXT NOT NULL, `teacher_symbol` TEXT NOT NULL, `substitution` TEXT NOT NULL, `absence` TEXT NOT NULL, `resources` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "number",
- "columnName": "number",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "topic",
- "columnName": "topic",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherSymbol",
- "columnName": "teacher_symbol",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "substitution",
- "columnName": "substitution",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "absence",
- "columnName": "absence",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "resources",
- "columnName": "resources",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "ReportingUnits",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `real_id` INTEGER NOT NULL, `short` TEXT NOT NULL, `sender_id` INTEGER NOT NULL, `sender_name` TEXT NOT NULL, `roles` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "unitId",
- "columnName": "real_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "shortName",
- "columnName": "short",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "senderId",
- "columnName": "sender_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "senderName",
- "columnName": "sender_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "roles",
- "columnName": "roles",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Recipients",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `real_id` TEXT NOT NULL, `name` TEXT NOT NULL, `real_name` TEXT NOT NULL, `login_id` INTEGER NOT NULL, `unit_id` INTEGER NOT NULL, `role` INTEGER NOT NULL, `hash` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "userLoginId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "realId",
- "columnName": "real_id",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "realName",
- "columnName": "real_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "loginId",
- "columnName": "login_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "unitId",
- "columnName": "unit_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "role",
- "columnName": "role",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "hash",
- "columnName": "hash",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "MobileDevices",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `device_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `date` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "userLoginId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "deviceId",
- "columnName": "device_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Teachers",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `class_id` INTEGER NOT NULL, `subject` TEXT NOT NULL, `name` TEXT NOT NULL, `short_name` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "classId",
- "columnName": "class_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "shortName",
- "columnName": "short_name",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "School",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `class_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `address` TEXT NOT NULL, `contact` TEXT NOT NULL, `headmaster` TEXT NOT NULL, `pedagogue` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "classId",
- "columnName": "class_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "address",
- "columnName": "address",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "contact",
- "columnName": "contact",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "headmaster",
- "columnName": "headmaster",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "pedagogue",
- "columnName": "pedagogue",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Conferences",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `title` TEXT NOT NULL, `subject` TEXT NOT NULL, `agenda` TEXT NOT NULL, `present_on_conference` TEXT NOT NULL, `conference_id` INTEGER NOT NULL, `date` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "title",
- "columnName": "title",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "agenda",
- "columnName": "agenda",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "presentOnConference",
- "columnName": "present_on_conference",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "conferenceId",
- "columnName": "conference_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "TimetableAdditional",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `start` INTEGER NOT NULL, `end` INTEGER NOT NULL, `date` INTEGER NOT NULL, `subject` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "start",
- "columnName": "start",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "end",
- "columnName": "end",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "StudentInfo",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `full_name` TEXT NOT NULL, `first_name` TEXT NOT NULL, `second_name` TEXT NOT NULL, `surname` TEXT NOT NULL, `birth_date` INTEGER NOT NULL, `birth_place` TEXT NOT NULL, `gender` TEXT NOT NULL, `has_polish_citizenship` INTEGER NOT NULL, `family_name` TEXT NOT NULL, `parents_names` TEXT NOT NULL, `address` TEXT NOT NULL, `registered_address` TEXT NOT NULL, `correspondence_address` TEXT NOT NULL, `phone_number` TEXT NOT NULL, `cell_phone_number` TEXT NOT NULL, `email` TEXT NOT NULL, `first_guardian_full_name` TEXT NOT NULL, `first_guardian_kinship` TEXT NOT NULL, `first_guardian_address` TEXT NOT NULL, `first_guardian_phones` TEXT NOT NULL, `first_guardian_email` TEXT NOT NULL, `second_guardian_full_name` TEXT NOT NULL, `second_guardian_kinship` TEXT NOT NULL, `second_guardian_address` TEXT NOT NULL, `second_guardian_phones` TEXT NOT NULL, `second_guardian_email` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "fullName",
- "columnName": "full_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "firstName",
- "columnName": "first_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "secondName",
- "columnName": "second_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "surname",
- "columnName": "surname",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "birthDate",
- "columnName": "birth_date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "birthPlace",
- "columnName": "birth_place",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "gender",
- "columnName": "gender",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "hasPolishCitizenship",
- "columnName": "has_polish_citizenship",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "familyName",
- "columnName": "family_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "parentsNames",
- "columnName": "parents_names",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "address",
- "columnName": "address",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "registeredAddress",
- "columnName": "registered_address",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "correspondenceAddress",
- "columnName": "correspondence_address",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "phoneNumber",
- "columnName": "phone_number",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "cellPhoneNumber",
- "columnName": "cell_phone_number",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "email",
- "columnName": "email",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "firstGuardian.fullName",
- "columnName": "first_guardian_full_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "firstGuardian.kinship",
- "columnName": "first_guardian_kinship",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "firstGuardian.address",
- "columnName": "first_guardian_address",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "firstGuardian.phones",
- "columnName": "first_guardian_phones",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "firstGuardian.email",
- "columnName": "first_guardian_email",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "secondGuardian.fullName",
- "columnName": "second_guardian_full_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "secondGuardian.kinship",
- "columnName": "second_guardian_kinship",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "secondGuardian.address",
- "columnName": "second_guardian_address",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "secondGuardian.phones",
- "columnName": "second_guardian_phones",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "secondGuardian.email",
- "columnName": "second_guardian_email",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- }
- ],
- "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, 'd642512ffa5fe81ae9308c9c55612539')"
- ]
- }
-}
diff --git a/app/schemas/io.github.wulkanowy.data.db.AppDatabase/32.json b/app/schemas/io.github.wulkanowy.data.db.AppDatabase/32.json
deleted file mode 100644
index 3621be48..00000000
--- a/app/schemas/io.github.wulkanowy.data.db.AppDatabase/32.json
+++ /dev/null
@@ -1,2142 +0,0 @@
-{
- "formatVersion": 1,
- "database": {
- "version": 32,
- "identityHash": "9531cdc8b3f0e62db5ab6ebe66837a28",
- "entities": [
- {
- "tableName": "Students",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `nick` TEXT NOT NULL, `scrapper_base_url` TEXT NOT NULL, `mobile_base_url` TEXT NOT NULL, `login_type` TEXT NOT NULL, `login_mode` TEXT NOT NULL, `certificate_key` TEXT NOT NULL, `private_key` TEXT NOT NULL, `is_parent` INTEGER NOT NULL, `email` TEXT NOT NULL, `password` TEXT NOT NULL, `symbol` TEXT NOT NULL, `student_id` INTEGER NOT NULL, `user_login_id` INTEGER NOT NULL, `user_name` TEXT NOT NULL, `student_name` TEXT NOT NULL, `school_id` TEXT NOT NULL, `school_short` TEXT NOT NULL, `school_name` TEXT NOT NULL, `class_name` TEXT NOT NULL, `class_id` INTEGER NOT NULL, `is_current` INTEGER NOT NULL, `registration_date` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "nick",
- "columnName": "nick",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "scrapperBaseUrl",
- "columnName": "scrapper_base_url",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "mobileBaseUrl",
- "columnName": "mobile_base_url",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "loginType",
- "columnName": "login_type",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "loginMode",
- "columnName": "login_mode",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "certificateKey",
- "columnName": "certificate_key",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "privateKey",
- "columnName": "private_key",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "isParent",
- "columnName": "is_parent",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "email",
- "columnName": "email",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "password",
- "columnName": "password",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "symbol",
- "columnName": "symbol",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "userLoginId",
- "columnName": "user_login_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "userName",
- "columnName": "user_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "studentName",
- "columnName": "student_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "schoolSymbol",
- "columnName": "school_id",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "schoolShortName",
- "columnName": "school_short",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "schoolName",
- "columnName": "school_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "className",
- "columnName": "class_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "classId",
- "columnName": "class_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isCurrent",
- "columnName": "is_current",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "registrationDate",
- "columnName": "registration_date",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [
- {
- "name": "index_Students_email_symbol_student_id_school_id_class_id",
- "unique": true,
- "columnNames": [
- "email",
- "symbol",
- "student_id",
- "school_id",
- "class_id"
- ],
- "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_Students_email_symbol_student_id_school_id_class_id` ON `${TABLE_NAME}` (`email`, `symbol`, `student_id`, `school_id`, `class_id`)"
- }
- ],
- "foreignKeys": []
- },
- {
- "tableName": "Semesters",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_current` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `diary_name` TEXT NOT NULL, `school_year` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `semester_name` INTEGER NOT NULL, `start` INTEGER NOT NULL, `end` INTEGER NOT NULL, `class_id` INTEGER NOT NULL, `unit_id` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "current",
- "columnName": "is_current",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryName",
- "columnName": "diary_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "schoolYear",
- "columnName": "school_year",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterName",
- "columnName": "semester_name",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "start",
- "columnName": "start",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "end",
- "columnName": "end",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "classId",
- "columnName": "class_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "unitId",
- "columnName": "unit_id",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [
- {
- "name": "index_Semesters_student_id_diary_id_semester_id",
- "unique": true,
- "columnNames": [
- "student_id",
- "diary_id",
- "semester_id"
- ],
- "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_Semesters_student_id_diary_id_semester_id` ON `${TABLE_NAME}` (`student_id`, `diary_id`, `semester_id`)"
- }
- ],
- "foreignKeys": []
- },
- {
- "tableName": "Exams",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `entry_date` INTEGER NOT NULL, `subject` TEXT NOT NULL, `group` TEXT NOT NULL, `type` TEXT NOT NULL, `description` TEXT NOT NULL, `teacher` TEXT NOT NULL, `teacher_symbol` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "entryDate",
- "columnName": "entry_date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "group",
- "columnName": "group",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "type",
- "columnName": "type",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "description",
- "columnName": "description",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherSymbol",
- "columnName": "teacher_symbol",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Timetable",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `number` INTEGER NOT NULL, `start` INTEGER NOT NULL, `end` INTEGER NOT NULL, `date` INTEGER NOT NULL, `subject` TEXT NOT NULL, `subjectOld` TEXT NOT NULL, `group` TEXT NOT NULL, `room` TEXT NOT NULL, `roomOld` TEXT NOT NULL, `teacher` TEXT NOT NULL, `teacherOld` TEXT NOT NULL, `info` TEXT NOT NULL, `student_plan` INTEGER NOT NULL, `changes` INTEGER NOT NULL, `canceled` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "number",
- "columnName": "number",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "start",
- "columnName": "start",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "end",
- "columnName": "end",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "subjectOld",
- "columnName": "subjectOld",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "group",
- "columnName": "group",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "room",
- "columnName": "room",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "roomOld",
- "columnName": "roomOld",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherOld",
- "columnName": "teacherOld",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "info",
- "columnName": "info",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "isStudentPlan",
- "columnName": "student_plan",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "changes",
- "columnName": "changes",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "canceled",
- "columnName": "canceled",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Attendance",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `time_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `number` INTEGER NOT NULL, `subject` TEXT NOT NULL, `name` TEXT NOT NULL, `presence` INTEGER NOT NULL, `absence` INTEGER NOT NULL, `exemption` INTEGER NOT NULL, `lateness` INTEGER NOT NULL, `excused` INTEGER NOT NULL, `deleted` INTEGER NOT NULL, `excusable` INTEGER NOT NULL, `excuse_status` TEXT)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "timeId",
- "columnName": "time_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "number",
- "columnName": "number",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "presence",
- "columnName": "presence",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "absence",
- "columnName": "absence",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "exemption",
- "columnName": "exemption",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "lateness",
- "columnName": "lateness",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "excused",
- "columnName": "excused",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "deleted",
- "columnName": "deleted",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "excusable",
- "columnName": "excusable",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "excuseStatus",
- "columnName": "excuse_status",
- "affinity": "TEXT",
- "notNull": false
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "AttendanceSummary",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `subject_id` INTEGER NOT NULL, `month` INTEGER NOT NULL, `presence` INTEGER NOT NULL, `absence` INTEGER NOT NULL, `absence_excused` INTEGER NOT NULL, `absence_for_school_reasons` INTEGER NOT NULL, `lateness` INTEGER NOT NULL, `lateness_excused` INTEGER NOT NULL, `exemption` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subjectId",
- "columnName": "subject_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "month",
- "columnName": "month",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "presence",
- "columnName": "presence",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "absence",
- "columnName": "absence",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "absenceExcused",
- "columnName": "absence_excused",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "absenceForSchoolReasons",
- "columnName": "absence_for_school_reasons",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "lateness",
- "columnName": "lateness",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "latenessExcused",
- "columnName": "lateness_excused",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "exemption",
- "columnName": "exemption",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Grades",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_read` INTEGER NOT NULL, `is_notified` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `subject` TEXT NOT NULL, `entry` TEXT NOT NULL, `value` REAL NOT NULL, `modifier` REAL NOT NULL, `comment` TEXT NOT NULL, `color` TEXT NOT NULL, `grade_symbol` TEXT NOT NULL, `description` TEXT NOT NULL, `weight` TEXT NOT NULL, `weightValue` REAL NOT NULL, `date` INTEGER NOT NULL, `teacher` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isRead",
- "columnName": "is_read",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isNotified",
- "columnName": "is_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "entry",
- "columnName": "entry",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "value",
- "columnName": "value",
- "affinity": "REAL",
- "notNull": true
- },
- {
- "fieldPath": "modifier",
- "columnName": "modifier",
- "affinity": "REAL",
- "notNull": true
- },
- {
- "fieldPath": "comment",
- "columnName": "comment",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "color",
- "columnName": "color",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "gradeSymbol",
- "columnName": "grade_symbol",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "description",
- "columnName": "description",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "weight",
- "columnName": "weight",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "weightValue",
- "columnName": "weightValue",
- "affinity": "REAL",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "GradesSummary",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_predicted_grade_notified` INTEGER NOT NULL, `is_final_grade_notified` INTEGER NOT NULL, `predicted_grade_last_change` INTEGER NOT NULL, `final_grade_last_change` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `position` INTEGER NOT NULL, `subject` TEXT NOT NULL, `predicted_grade` TEXT NOT NULL, `final_grade` TEXT NOT NULL, `proposed_points` TEXT NOT NULL, `final_points` TEXT NOT NULL, `points_sum` TEXT NOT NULL, `average` REAL NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isPredictedGradeNotified",
- "columnName": "is_predicted_grade_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isFinalGradeNotified",
- "columnName": "is_final_grade_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "predictedGradeLastChange",
- "columnName": "predicted_grade_last_change",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "finalGradeLastChange",
- "columnName": "final_grade_last_change",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "position",
- "columnName": "position",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "predictedGrade",
- "columnName": "predicted_grade",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "finalGrade",
- "columnName": "final_grade",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "proposedPoints",
- "columnName": "proposed_points",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "finalPoints",
- "columnName": "final_points",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "pointsSum",
- "columnName": "points_sum",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "average",
- "columnName": "average",
- "affinity": "REAL",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "GradePartialStatistics",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `subject` TEXT NOT NULL, `class_average` TEXT NOT NULL, `student_average` TEXT NOT NULL, `class_amounts` TEXT NOT NULL, `student_amounts` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "classAverage",
- "columnName": "class_average",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "studentAverage",
- "columnName": "student_average",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "classAmounts",
- "columnName": "class_amounts",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "studentAmounts",
- "columnName": "student_amounts",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "GradesPointsStatistics",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `subject` TEXT NOT NULL, `others` REAL NOT NULL, `student` REAL NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "others",
- "columnName": "others",
- "affinity": "REAL",
- "notNull": true
- },
- {
- "fieldPath": "student",
- "columnName": "student",
- "affinity": "REAL",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "GradeSemesterStatistics",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `subject` TEXT NOT NULL, `amounts` TEXT NOT NULL, `student_grade` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "amounts",
- "columnName": "amounts",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "studentGrade",
- "columnName": "student_grade",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Messages",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_notified` INTEGER NOT NULL, `unread_by` INTEGER NOT NULL, `read_by` INTEGER NOT NULL, `content` TEXT NOT NULL, `student_id` INTEGER NOT NULL, `real_id` INTEGER NOT NULL, `message_id` INTEGER NOT NULL, `sender_name` TEXT NOT NULL, `sender_id` INTEGER NOT NULL, `recipient_name` TEXT NOT NULL, `subject` TEXT NOT NULL, `date` INTEGER NOT NULL, `folder_id` INTEGER NOT NULL, `unread` INTEGER NOT NULL, `removed` INTEGER NOT NULL, `has_attachments` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isNotified",
- "columnName": "is_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "unreadBy",
- "columnName": "unread_by",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "readBy",
- "columnName": "read_by",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "content",
- "columnName": "content",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "realId",
- "columnName": "real_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "messageId",
- "columnName": "message_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "sender",
- "columnName": "sender_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "senderId",
- "columnName": "sender_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "recipient",
- "columnName": "recipient_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "folderId",
- "columnName": "folder_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "unread",
- "columnName": "unread",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "removed",
- "columnName": "removed",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "hasAttachments",
- "columnName": "has_attachments",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "MessageAttachments",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`real_id` INTEGER NOT NULL, `message_id` INTEGER NOT NULL, `one_drive_id` TEXT NOT NULL, `url` TEXT NOT NULL, `filename` TEXT NOT NULL, PRIMARY KEY(`real_id`))",
- "fields": [
- {
- "fieldPath": "realId",
- "columnName": "real_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "messageId",
- "columnName": "message_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "oneDriveId",
- "columnName": "one_drive_id",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "url",
- "columnName": "url",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "filename",
- "columnName": "filename",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "real_id"
- ],
- "autoGenerate": false
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Notes",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_read` INTEGER NOT NULL, `is_notified` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `teacher` TEXT NOT NULL, `teacher_symbol` TEXT NOT NULL, `category` TEXT NOT NULL, `category_type` INTEGER NOT NULL, `is_points_show` INTEGER NOT NULL, `points` INTEGER NOT NULL, `content` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isRead",
- "columnName": "is_read",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isNotified",
- "columnName": "is_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherSymbol",
- "columnName": "teacher_symbol",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "category",
- "columnName": "category",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "categoryType",
- "columnName": "category_type",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isPointsShow",
- "columnName": "is_points_show",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "points",
- "columnName": "points",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "content",
- "columnName": "content",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Homework",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_done` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `entry_date` INTEGER NOT NULL, `subject` TEXT NOT NULL, `content` TEXT NOT NULL, `teacher` TEXT NOT NULL, `teacher_symbol` TEXT NOT NULL, `attachments` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isDone",
- "columnName": "is_done",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "entryDate",
- "columnName": "entry_date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "content",
- "columnName": "content",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherSymbol",
- "columnName": "teacher_symbol",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "attachments",
- "columnName": "attachments",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Subjects",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `real_id` INTEGER NOT NULL, `name` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "realId",
- "columnName": "real_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "LuckyNumbers",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_notified` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `lucky_number` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isNotified",
- "columnName": "is_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "luckyNumber",
- "columnName": "lucky_number",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "CompletedLesson",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `number` INTEGER NOT NULL, `subject` TEXT NOT NULL, `topic` TEXT NOT NULL, `teacher` TEXT NOT NULL, `teacher_symbol` TEXT NOT NULL, `substitution` TEXT NOT NULL, `absence` TEXT NOT NULL, `resources` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "number",
- "columnName": "number",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "topic",
- "columnName": "topic",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherSymbol",
- "columnName": "teacher_symbol",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "substitution",
- "columnName": "substitution",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "absence",
- "columnName": "absence",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "resources",
- "columnName": "resources",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "ReportingUnits",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `real_id` INTEGER NOT NULL, `short` TEXT NOT NULL, `sender_id` INTEGER NOT NULL, `sender_name` TEXT NOT NULL, `roles` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "unitId",
- "columnName": "real_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "shortName",
- "columnName": "short",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "senderId",
- "columnName": "sender_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "senderName",
- "columnName": "sender_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "roles",
- "columnName": "roles",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Recipients",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `real_id` TEXT NOT NULL, `name` TEXT NOT NULL, `real_name` TEXT NOT NULL, `login_id` INTEGER NOT NULL, `unit_id` INTEGER NOT NULL, `role` INTEGER NOT NULL, `hash` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "userLoginId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "realId",
- "columnName": "real_id",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "realName",
- "columnName": "real_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "loginId",
- "columnName": "login_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "unitId",
- "columnName": "unit_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "role",
- "columnName": "role",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "hash",
- "columnName": "hash",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "MobileDevices",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `device_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `date` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "userLoginId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "deviceId",
- "columnName": "device_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Teachers",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `class_id` INTEGER NOT NULL, `subject` TEXT NOT NULL, `name` TEXT NOT NULL, `short_name` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "classId",
- "columnName": "class_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "shortName",
- "columnName": "short_name",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "School",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `class_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `address` TEXT NOT NULL, `contact` TEXT NOT NULL, `headmaster` TEXT NOT NULL, `pedagogue` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "classId",
- "columnName": "class_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "address",
- "columnName": "address",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "contact",
- "columnName": "contact",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "headmaster",
- "columnName": "headmaster",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "pedagogue",
- "columnName": "pedagogue",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Conferences",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `title` TEXT NOT NULL, `subject` TEXT NOT NULL, `agenda` TEXT NOT NULL, `present_on_conference` TEXT NOT NULL, `conference_id` INTEGER NOT NULL, `date` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "title",
- "columnName": "title",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "agenda",
- "columnName": "agenda",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "presentOnConference",
- "columnName": "present_on_conference",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "conferenceId",
- "columnName": "conference_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "TimetableAdditional",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `start` INTEGER NOT NULL, `end` INTEGER NOT NULL, `date` INTEGER NOT NULL, `subject` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "start",
- "columnName": "start",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "end",
- "columnName": "end",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "StudentInfo",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `full_name` TEXT NOT NULL, `first_name` TEXT NOT NULL, `second_name` TEXT NOT NULL, `surname` TEXT NOT NULL, `birth_date` INTEGER NOT NULL, `birth_place` TEXT NOT NULL, `gender` TEXT NOT NULL, `has_polish_citizenship` INTEGER NOT NULL, `family_name` TEXT NOT NULL, `parents_names` TEXT NOT NULL, `address` TEXT NOT NULL, `registered_address` TEXT NOT NULL, `correspondence_address` TEXT NOT NULL, `phone_number` TEXT NOT NULL, `cell_phone_number` TEXT NOT NULL, `email` TEXT NOT NULL, `first_guardian_full_name` TEXT NOT NULL, `first_guardian_kinship` TEXT NOT NULL, `first_guardian_address` TEXT NOT NULL, `first_guardian_phones` TEXT NOT NULL, `first_guardian_email` TEXT NOT NULL, `second_guardian_full_name` TEXT NOT NULL, `second_guardian_kinship` TEXT NOT NULL, `second_guardian_address` TEXT NOT NULL, `second_guardian_phones` TEXT NOT NULL, `second_guardian_email` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "fullName",
- "columnName": "full_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "firstName",
- "columnName": "first_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "secondName",
- "columnName": "second_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "surname",
- "columnName": "surname",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "birthDate",
- "columnName": "birth_date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "birthPlace",
- "columnName": "birth_place",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "gender",
- "columnName": "gender",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "hasPolishCitizenship",
- "columnName": "has_polish_citizenship",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "familyName",
- "columnName": "family_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "parentsNames",
- "columnName": "parents_names",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "address",
- "columnName": "address",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "registeredAddress",
- "columnName": "registered_address",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "correspondenceAddress",
- "columnName": "correspondence_address",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "phoneNumber",
- "columnName": "phone_number",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "cellPhoneNumber",
- "columnName": "cell_phone_number",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "email",
- "columnName": "email",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "firstGuardian.fullName",
- "columnName": "first_guardian_full_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "firstGuardian.kinship",
- "columnName": "first_guardian_kinship",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "firstGuardian.address",
- "columnName": "first_guardian_address",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "firstGuardian.phones",
- "columnName": "first_guardian_phones",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "firstGuardian.email",
- "columnName": "first_guardian_email",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "secondGuardian.fullName",
- "columnName": "second_guardian_full_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "secondGuardian.kinship",
- "columnName": "second_guardian_kinship",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "secondGuardian.address",
- "columnName": "second_guardian_address",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "secondGuardian.phones",
- "columnName": "second_guardian_phones",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "secondGuardian.email",
- "columnName": "second_guardian_email",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- }
- ],
- "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, '9531cdc8b3f0e62db5ab6ebe66837a28')"
- ]
- }
-}
\ No newline at end of file
diff --git a/app/schemas/io.github.wulkanowy.data.db.AppDatabase/33.json b/app/schemas/io.github.wulkanowy.data.db.AppDatabase/33.json
deleted file mode 100644
index 255c196e..00000000
--- a/app/schemas/io.github.wulkanowy.data.db.AppDatabase/33.json
+++ /dev/null
@@ -1,2142 +0,0 @@
-{
- "formatVersion": 1,
- "database": {
- "version": 33,
- "identityHash": "c024cc4e19e009a03303e2bfe5c34b48",
- "entities": [
- {
- "tableName": "Students",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `nick` TEXT NOT NULL, `scrapper_base_url` TEXT NOT NULL, `mobile_base_url` TEXT NOT NULL, `login_type` TEXT NOT NULL, `login_mode` TEXT NOT NULL, `certificate_key` TEXT NOT NULL, `private_key` TEXT NOT NULL, `is_parent` INTEGER NOT NULL, `email` TEXT NOT NULL, `password` TEXT NOT NULL, `symbol` TEXT NOT NULL, `student_id` INTEGER NOT NULL, `user_login_id` INTEGER NOT NULL, `user_name` TEXT NOT NULL, `student_name` TEXT NOT NULL, `school_id` TEXT NOT NULL, `school_short` TEXT NOT NULL, `school_name` TEXT NOT NULL, `class_name` TEXT NOT NULL, `class_id` INTEGER NOT NULL, `is_current` INTEGER NOT NULL, `registration_date` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "nick",
- "columnName": "nick",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "scrapperBaseUrl",
- "columnName": "scrapper_base_url",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "mobileBaseUrl",
- "columnName": "mobile_base_url",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "loginType",
- "columnName": "login_type",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "loginMode",
- "columnName": "login_mode",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "certificateKey",
- "columnName": "certificate_key",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "privateKey",
- "columnName": "private_key",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "isParent",
- "columnName": "is_parent",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "email",
- "columnName": "email",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "password",
- "columnName": "password",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "symbol",
- "columnName": "symbol",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "userLoginId",
- "columnName": "user_login_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "userName",
- "columnName": "user_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "studentName",
- "columnName": "student_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "schoolSymbol",
- "columnName": "school_id",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "schoolShortName",
- "columnName": "school_short",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "schoolName",
- "columnName": "school_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "className",
- "columnName": "class_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "classId",
- "columnName": "class_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isCurrent",
- "columnName": "is_current",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "registrationDate",
- "columnName": "registration_date",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [
- {
- "name": "index_Students_email_symbol_student_id_school_id_class_id",
- "unique": true,
- "columnNames": [
- "email",
- "symbol",
- "student_id",
- "school_id",
- "class_id"
- ],
- "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_Students_email_symbol_student_id_school_id_class_id` ON `${TABLE_NAME}` (`email`, `symbol`, `student_id`, `school_id`, `class_id`)"
- }
- ],
- "foreignKeys": []
- },
- {
- "tableName": "Semesters",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_current` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `diary_name` TEXT NOT NULL, `school_year` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `semester_name` INTEGER NOT NULL, `start` INTEGER NOT NULL, `end` INTEGER NOT NULL, `class_id` INTEGER NOT NULL, `unit_id` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "current",
- "columnName": "is_current",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryName",
- "columnName": "diary_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "schoolYear",
- "columnName": "school_year",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterName",
- "columnName": "semester_name",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "start",
- "columnName": "start",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "end",
- "columnName": "end",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "classId",
- "columnName": "class_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "unitId",
- "columnName": "unit_id",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [
- {
- "name": "index_Semesters_student_id_diary_id_semester_id",
- "unique": true,
- "columnNames": [
- "student_id",
- "diary_id",
- "semester_id"
- ],
- "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_Semesters_student_id_diary_id_semester_id` ON `${TABLE_NAME}` (`student_id`, `diary_id`, `semester_id`)"
- }
- ],
- "foreignKeys": []
- },
- {
- "tableName": "Exams",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `entry_date` INTEGER NOT NULL, `subject` TEXT NOT NULL, `group` TEXT NOT NULL, `type` TEXT NOT NULL, `description` TEXT NOT NULL, `teacher` TEXT NOT NULL, `teacher_symbol` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "entryDate",
- "columnName": "entry_date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "group",
- "columnName": "group",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "type",
- "columnName": "type",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "description",
- "columnName": "description",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherSymbol",
- "columnName": "teacher_symbol",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Timetable",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `number` INTEGER NOT NULL, `start` INTEGER NOT NULL, `end` INTEGER NOT NULL, `date` INTEGER NOT NULL, `subject` TEXT NOT NULL, `subjectOld` TEXT NOT NULL, `group` TEXT NOT NULL, `room` TEXT NOT NULL, `roomOld` TEXT NOT NULL, `teacher` TEXT NOT NULL, `teacherOld` TEXT NOT NULL, `info` TEXT NOT NULL, `student_plan` INTEGER NOT NULL, `changes` INTEGER NOT NULL, `canceled` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "number",
- "columnName": "number",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "start",
- "columnName": "start",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "end",
- "columnName": "end",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "subjectOld",
- "columnName": "subjectOld",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "group",
- "columnName": "group",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "room",
- "columnName": "room",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "roomOld",
- "columnName": "roomOld",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherOld",
- "columnName": "teacherOld",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "info",
- "columnName": "info",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "isStudentPlan",
- "columnName": "student_plan",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "changes",
- "columnName": "changes",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "canceled",
- "columnName": "canceled",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Attendance",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `time_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `number` INTEGER NOT NULL, `subject` TEXT NOT NULL, `name` TEXT NOT NULL, `presence` INTEGER NOT NULL, `absence` INTEGER NOT NULL, `exemption` INTEGER NOT NULL, `lateness` INTEGER NOT NULL, `excused` INTEGER NOT NULL, `deleted` INTEGER NOT NULL, `excusable` INTEGER NOT NULL, `excuse_status` TEXT)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "timeId",
- "columnName": "time_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "number",
- "columnName": "number",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "presence",
- "columnName": "presence",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "absence",
- "columnName": "absence",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "exemption",
- "columnName": "exemption",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "lateness",
- "columnName": "lateness",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "excused",
- "columnName": "excused",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "deleted",
- "columnName": "deleted",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "excusable",
- "columnName": "excusable",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "excuseStatus",
- "columnName": "excuse_status",
- "affinity": "TEXT",
- "notNull": false
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "AttendanceSummary",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `subject_id` INTEGER NOT NULL, `month` INTEGER NOT NULL, `presence` INTEGER NOT NULL, `absence` INTEGER NOT NULL, `absence_excused` INTEGER NOT NULL, `absence_for_school_reasons` INTEGER NOT NULL, `lateness` INTEGER NOT NULL, `lateness_excused` INTEGER NOT NULL, `exemption` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subjectId",
- "columnName": "subject_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "month",
- "columnName": "month",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "presence",
- "columnName": "presence",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "absence",
- "columnName": "absence",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "absenceExcused",
- "columnName": "absence_excused",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "absenceForSchoolReasons",
- "columnName": "absence_for_school_reasons",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "lateness",
- "columnName": "lateness",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "latenessExcused",
- "columnName": "lateness_excused",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "exemption",
- "columnName": "exemption",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Grades",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_read` INTEGER NOT NULL, `is_notified` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `subject` TEXT NOT NULL, `entry` TEXT NOT NULL, `value` REAL NOT NULL, `modifier` REAL NOT NULL, `comment` TEXT NOT NULL, `color` TEXT NOT NULL, `grade_symbol` TEXT NOT NULL, `description` TEXT NOT NULL, `weight` TEXT NOT NULL, `weightValue` REAL NOT NULL, `date` INTEGER NOT NULL, `teacher` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isRead",
- "columnName": "is_read",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isNotified",
- "columnName": "is_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "entry",
- "columnName": "entry",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "value",
- "columnName": "value",
- "affinity": "REAL",
- "notNull": true
- },
- {
- "fieldPath": "modifier",
- "columnName": "modifier",
- "affinity": "REAL",
- "notNull": true
- },
- {
- "fieldPath": "comment",
- "columnName": "comment",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "color",
- "columnName": "color",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "gradeSymbol",
- "columnName": "grade_symbol",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "description",
- "columnName": "description",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "weight",
- "columnName": "weight",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "weightValue",
- "columnName": "weightValue",
- "affinity": "REAL",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "GradesSummary",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_predicted_grade_notified` INTEGER NOT NULL, `is_final_grade_notified` INTEGER NOT NULL, `predicted_grade_last_change` INTEGER NOT NULL, `final_grade_last_change` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `position` INTEGER NOT NULL, `subject` TEXT NOT NULL, `predicted_grade` TEXT NOT NULL, `final_grade` TEXT NOT NULL, `proposed_points` TEXT NOT NULL, `final_points` TEXT NOT NULL, `points_sum` TEXT NOT NULL, `average` REAL NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isPredictedGradeNotified",
- "columnName": "is_predicted_grade_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isFinalGradeNotified",
- "columnName": "is_final_grade_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "predictedGradeLastChange",
- "columnName": "predicted_grade_last_change",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "finalGradeLastChange",
- "columnName": "final_grade_last_change",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "position",
- "columnName": "position",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "predictedGrade",
- "columnName": "predicted_grade",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "finalGrade",
- "columnName": "final_grade",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "proposedPoints",
- "columnName": "proposed_points",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "finalPoints",
- "columnName": "final_points",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "pointsSum",
- "columnName": "points_sum",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "average",
- "columnName": "average",
- "affinity": "REAL",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "GradePartialStatistics",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `subject` TEXT NOT NULL, `class_average` TEXT NOT NULL, `student_average` TEXT NOT NULL, `class_amounts` TEXT NOT NULL, `student_amounts` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "classAverage",
- "columnName": "class_average",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "studentAverage",
- "columnName": "student_average",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "classAmounts",
- "columnName": "class_amounts",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "studentAmounts",
- "columnName": "student_amounts",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "GradesPointsStatistics",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `subject` TEXT NOT NULL, `others` REAL NOT NULL, `student` REAL NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "others",
- "columnName": "others",
- "affinity": "REAL",
- "notNull": true
- },
- {
- "fieldPath": "student",
- "columnName": "student",
- "affinity": "REAL",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "GradeSemesterStatistics",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `subject` TEXT NOT NULL, `amounts` TEXT NOT NULL, `student_grade` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "amounts",
- "columnName": "amounts",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "studentGrade",
- "columnName": "student_grade",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Messages",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_notified` INTEGER NOT NULL, `unread_by` INTEGER NOT NULL, `read_by` INTEGER NOT NULL, `content` TEXT NOT NULL, `student_id` INTEGER NOT NULL, `real_id` INTEGER NOT NULL, `message_id` INTEGER NOT NULL, `sender_name` TEXT NOT NULL, `sender_id` INTEGER NOT NULL, `recipient_name` TEXT NOT NULL, `subject` TEXT NOT NULL, `date` INTEGER NOT NULL, `folder_id` INTEGER NOT NULL, `unread` INTEGER NOT NULL, `removed` INTEGER NOT NULL, `has_attachments` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isNotified",
- "columnName": "is_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "unreadBy",
- "columnName": "unread_by",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "readBy",
- "columnName": "read_by",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "content",
- "columnName": "content",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "realId",
- "columnName": "real_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "messageId",
- "columnName": "message_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "sender",
- "columnName": "sender_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "senderId",
- "columnName": "sender_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "recipient",
- "columnName": "recipient_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "folderId",
- "columnName": "folder_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "unread",
- "columnName": "unread",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "removed",
- "columnName": "removed",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "hasAttachments",
- "columnName": "has_attachments",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "MessageAttachments",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`real_id` INTEGER NOT NULL, `message_id` INTEGER NOT NULL, `one_drive_id` TEXT NOT NULL, `url` TEXT NOT NULL, `filename` TEXT NOT NULL, PRIMARY KEY(`real_id`))",
- "fields": [
- {
- "fieldPath": "realId",
- "columnName": "real_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "messageId",
- "columnName": "message_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "oneDriveId",
- "columnName": "one_drive_id",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "url",
- "columnName": "url",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "filename",
- "columnName": "filename",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "real_id"
- ],
- "autoGenerate": false
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Notes",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_read` INTEGER NOT NULL, `is_notified` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `teacher` TEXT NOT NULL, `teacher_symbol` TEXT NOT NULL, `category` TEXT NOT NULL, `category_type` INTEGER NOT NULL, `is_points_show` INTEGER NOT NULL, `points` INTEGER NOT NULL, `content` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isRead",
- "columnName": "is_read",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isNotified",
- "columnName": "is_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherSymbol",
- "columnName": "teacher_symbol",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "category",
- "columnName": "category",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "categoryType",
- "columnName": "category_type",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isPointsShow",
- "columnName": "is_points_show",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "points",
- "columnName": "points",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "content",
- "columnName": "content",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Homework",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_done` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `entry_date` INTEGER NOT NULL, `subject` TEXT NOT NULL, `content` TEXT NOT NULL, `teacher` TEXT NOT NULL, `teacher_symbol` TEXT NOT NULL, `attachments` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isDone",
- "columnName": "is_done",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "semesterId",
- "columnName": "semester_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "entryDate",
- "columnName": "entry_date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "content",
- "columnName": "content",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherSymbol",
- "columnName": "teacher_symbol",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "attachments",
- "columnName": "attachments",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Subjects",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `real_id` INTEGER NOT NULL, `name` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "realId",
- "columnName": "real_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "LuckyNumbers",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `is_notified` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `lucky_number` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "isNotified",
- "columnName": "is_notified",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "luckyNumber",
- "columnName": "lucky_number",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "CompletedLesson",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `date` INTEGER NOT NULL, `number` INTEGER NOT NULL, `subject` TEXT NOT NULL, `topic` TEXT NOT NULL, `teacher` TEXT NOT NULL, `teacher_symbol` TEXT NOT NULL, `substitution` TEXT NOT NULL, `absence` TEXT NOT NULL, `resources` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "number",
- "columnName": "number",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "topic",
- "columnName": "topic",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacher",
- "columnName": "teacher",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "teacherSymbol",
- "columnName": "teacher_symbol",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "substitution",
- "columnName": "substitution",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "absence",
- "columnName": "absence",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "resources",
- "columnName": "resources",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "ReportingUnits",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `real_id` INTEGER NOT NULL, `short` TEXT NOT NULL, `sender_id` INTEGER NOT NULL, `sender_name` TEXT NOT NULL, `roles` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "unitId",
- "columnName": "real_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "shortName",
- "columnName": "short",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "senderId",
- "columnName": "sender_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "senderName",
- "columnName": "sender_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "roles",
- "columnName": "roles",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Recipients",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `real_id` TEXT NOT NULL, `name` TEXT NOT NULL, `real_name` TEXT NOT NULL, `login_id` INTEGER NOT NULL, `unit_id` INTEGER NOT NULL, `role` INTEGER NOT NULL, `hash` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "userLoginId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "realId",
- "columnName": "real_id",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "realName",
- "columnName": "real_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "loginId",
- "columnName": "login_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "unitId",
- "columnName": "unit_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "role",
- "columnName": "role",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "hash",
- "columnName": "hash",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "MobileDevices",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `device_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `date` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "userLoginId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "deviceId",
- "columnName": "device_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Teachers",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `class_id` INTEGER NOT NULL, `subject` TEXT NOT NULL, `name` TEXT NOT NULL, `short_name` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "classId",
- "columnName": "class_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "shortName",
- "columnName": "short_name",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "School",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `class_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `address` TEXT NOT NULL, `contact` TEXT NOT NULL, `headmaster` TEXT NOT NULL, `pedagogue` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "classId",
- "columnName": "class_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "name",
- "columnName": "name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "address",
- "columnName": "address",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "contact",
- "columnName": "contact",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "headmaster",
- "columnName": "headmaster",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "pedagogue",
- "columnName": "pedagogue",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "Conferences",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `title` TEXT NOT NULL, `subject` TEXT NOT NULL, `agenda` TEXT NOT NULL, `present_on_conference` TEXT NOT NULL, `conference_id` INTEGER NOT NULL, `date` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "title",
- "columnName": "title",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "agenda",
- "columnName": "agenda",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "presentOnConference",
- "columnName": "present_on_conference",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "conferenceId",
- "columnName": "conference_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "TimetableAdditional",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `diary_id` INTEGER NOT NULL, `start` INTEGER NOT NULL, `end` INTEGER NOT NULL, `date` INTEGER NOT NULL, `subject` TEXT NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "diaryId",
- "columnName": "diary_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "start",
- "columnName": "start",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "end",
- "columnName": "end",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "date",
- "columnName": "date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "subject",
- "columnName": "subject",
- "affinity": "TEXT",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "StudentInfo",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `student_id` INTEGER NOT NULL, `full_name` TEXT NOT NULL, `first_name` TEXT NOT NULL, `second_name` TEXT NOT NULL, `surname` TEXT NOT NULL, `birth_date` INTEGER NOT NULL, `birth_place` TEXT NOT NULL, `gender` TEXT NOT NULL, `has_polish_citizenship` INTEGER NOT NULL, `family_name` TEXT NOT NULL, `parents_names` TEXT NOT NULL, `address` TEXT NOT NULL, `registered_address` TEXT NOT NULL, `correspondence_address` TEXT NOT NULL, `phone_number` TEXT NOT NULL, `cell_phone_number` TEXT NOT NULL, `email` TEXT NOT NULL, `first_guardian_full_name` TEXT, `first_guardian_kinship` TEXT, `first_guardian_address` TEXT, `first_guardian_phones` TEXT, `first_guardian_email` TEXT, `second_guardian_full_name` TEXT, `second_guardian_kinship` TEXT, `second_guardian_address` TEXT, `second_guardian_phones` TEXT, `second_guardian_email` TEXT)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "studentId",
- "columnName": "student_id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "fullName",
- "columnName": "full_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "firstName",
- "columnName": "first_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "secondName",
- "columnName": "second_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "surname",
- "columnName": "surname",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "birthDate",
- "columnName": "birth_date",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "birthPlace",
- "columnName": "birth_place",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "gender",
- "columnName": "gender",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "hasPolishCitizenship",
- "columnName": "has_polish_citizenship",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "familyName",
- "columnName": "family_name",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "parentsNames",
- "columnName": "parents_names",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "address",
- "columnName": "address",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "registeredAddress",
- "columnName": "registered_address",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "correspondenceAddress",
- "columnName": "correspondence_address",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "phoneNumber",
- "columnName": "phone_number",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "cellPhoneNumber",
- "columnName": "cell_phone_number",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "email",
- "columnName": "email",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "firstGuardian.fullName",
- "columnName": "first_guardian_full_name",
- "affinity": "TEXT",
- "notNull": false
- },
- {
- "fieldPath": "firstGuardian.kinship",
- "columnName": "first_guardian_kinship",
- "affinity": "TEXT",
- "notNull": false
- },
- {
- "fieldPath": "firstGuardian.address",
- "columnName": "first_guardian_address",
- "affinity": "TEXT",
- "notNull": false
- },
- {
- "fieldPath": "firstGuardian.phones",
- "columnName": "first_guardian_phones",
- "affinity": "TEXT",
- "notNull": false
- },
- {
- "fieldPath": "firstGuardian.email",
- "columnName": "first_guardian_email",
- "affinity": "TEXT",
- "notNull": false
- },
- {
- "fieldPath": "secondGuardian.fullName",
- "columnName": "second_guardian_full_name",
- "affinity": "TEXT",
- "notNull": false
- },
- {
- "fieldPath": "secondGuardian.kinship",
- "columnName": "second_guardian_kinship",
- "affinity": "TEXT",
- "notNull": false
- },
- {
- "fieldPath": "secondGuardian.address",
- "columnName": "second_guardian_address",
- "affinity": "TEXT",
- "notNull": false
- },
- {
- "fieldPath": "secondGuardian.phones",
- "columnName": "second_guardian_phones",
- "affinity": "TEXT",
- "notNull": false
- },
- {
- "fieldPath": "secondGuardian.email",
- "columnName": "second_guardian_email",
- "affinity": "TEXT",
- "notNull": false
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- }
- ],
- "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, 'c024cc4e19e009a03303e2bfe5c34b48')"
- ]
- }
-}
\ No newline at end of file
diff --git a/app/src/androidTest/java/io/github/wulkanowy/data/TestDispatchersProvider.kt b/app/src/androidTest/java/io/github/wulkanowy/data/TestDispatchersProvider.kt
new file mode 100644
index 00000000..8c4354d9
--- /dev/null
+++ b/app/src/androidTest/java/io/github/wulkanowy/data/TestDispatchersProvider.kt
@@ -0,0 +1,11 @@
+package io.github.wulkanowy.data
+
+import io.github.wulkanowy.utils.DispatchersProvider
+import kotlinx.coroutines.CoroutineDispatcher
+import kotlinx.coroutines.Dispatchers
+
+class TestDispatchersProvider : DispatchersProvider() {
+
+ override val backgroundThread: CoroutineDispatcher
+ get() = Dispatchers.Unconfined
+}
diff --git a/app/src/androidTest/java/io/github/wulkanowy/data/db/migrations/AbstractMigrationTest.kt b/app/src/androidTest/java/io/github/wulkanowy/data/db/migrations/AbstractMigrationTest.kt
index aca28732..611161e5 100644
--- a/app/src/androidTest/java/io/github/wulkanowy/data/db/migrations/AbstractMigrationTest.kt
+++ b/app/src/androidTest/java/io/github/wulkanowy/data/db/migrations/AbstractMigrationTest.kt
@@ -1,6 +1,5 @@
package io.github.wulkanowy.data.db.migrations
-import android.content.Context
import androidx.preference.PreferenceManager
import androidx.room.Room
import androidx.room.testing.MigrationTestHelper
@@ -23,11 +22,10 @@ abstract class AbstractMigrationTest {
)
fun getMigratedRoomDatabase(): AppDatabase {
- val context = ApplicationProvider.getApplicationContext()
val database = Room.databaseBuilder(ApplicationProvider.getApplicationContext(),
AppDatabase::class.java, dbName)
.addMigrations(*AppDatabase.getMigrations(SharedPrefProvider(PreferenceManager
- .getDefaultSharedPreferences(context)))
+ .getDefaultSharedPreferences(ApplicationProvider.getApplicationContext())))
)
.build()
// close the database and release any stream resources when the test finishes
diff --git a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/TestEntityCreator.kt b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/TestEntityCreator.kt
new file mode 100644
index 00000000..04d13be4
--- /dev/null
+++ b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/TestEntityCreator.kt
@@ -0,0 +1,45 @@
+package io.github.wulkanowy.data.repositories
+
+import io.github.wulkanowy.data.db.entities.Semester
+import io.github.wulkanowy.data.db.entities.Student
+import java.time.LocalDate.now
+import java.time.LocalDateTime
+
+fun getStudent(): Student {
+ return Student(
+ email = "test",
+ password = "test123",
+ schoolSymbol = "23",
+ scrapperBaseUrl = "fakelog.cf",
+ loginType = "AUTO",
+ isCurrent = true,
+ userName = "",
+ studentName = "",
+ schoolShortName = "",
+ schoolName = "",
+ studentId = 0,
+ classId = 1,
+ symbol = "",
+ registrationDate = LocalDateTime.now(),
+ className = "",
+ loginMode = "API",
+ certificateKey = "",
+ privateKey = "",
+ mobileBaseUrl = "",
+ userLoginId = 0,
+ isParent = false
+ )
+}
+
+fun getSemester() = Semester(
+ semesterId = 1,
+ studentId = 1,
+ classId = 1,
+ diaryId = 2,
+ diaryName = "",
+ end = now(),
+ schoolYear = 2019,
+ semesterName = 1,
+ start = now(),
+ unitId = 1
+)
diff --git a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/attendance/AttendanceLocalTest.kt b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/attendance/AttendanceLocalTest.kt
new file mode 100644
index 00000000..fa128986
--- /dev/null
+++ b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/attendance/AttendanceLocalTest.kt
@@ -0,0 +1,83 @@
+package io.github.wulkanowy.data.repositories.attendance
+
+import androidx.room.Room
+import androidx.test.core.app.ApplicationProvider
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import io.github.wulkanowy.data.db.AppDatabase
+import io.github.wulkanowy.data.db.entities.Attendance
+import io.github.wulkanowy.data.db.entities.Semester
+import kotlinx.coroutines.flow.first
+import kotlinx.coroutines.runBlocking
+import org.junit.After
+import org.junit.Before
+import org.junit.Test
+import org.junit.runner.RunWith
+import java.time.LocalDate
+import java.time.LocalDate.now
+import java.time.LocalDate.of
+import kotlin.test.assertEquals
+
+@RunWith(AndroidJUnit4::class)
+class AttendanceLocalTest {
+
+ private lateinit var attendanceLocal: AttendanceLocal
+
+ private lateinit var testDb: AppDatabase
+
+ @Before
+ fun createDb() {
+ testDb = Room.inMemoryDatabaseBuilder(ApplicationProvider.getApplicationContext(), AppDatabase::class.java).build()
+ attendanceLocal = AttendanceLocal(testDb.attendanceDao)
+ }
+
+ @After
+ fun closeDb() {
+ testDb.close()
+ }
+
+ @Test
+ fun saveAndReadTest() {
+ val list = listOf(
+ getAttendanceEntity(
+ of(2018, 9, 10),
+ SentExcuseStatus.ACCEPTED
+ ),
+ getAttendanceEntity(
+ of(2018, 9, 14),
+ SentExcuseStatus.WAITING
+ ),
+ getAttendanceEntity(
+ of(2018, 9, 17),
+ SentExcuseStatus.ACCEPTED
+ )
+ )
+ runBlocking { attendanceLocal.saveAttendance(list) }
+
+ val semester = Semester(1, 2, "", 1, 3, 2019, now(), now(), 1, 1)
+ val attendance = runBlocking { attendanceLocal.getAttendance(semester, of(2018, 9, 10), of(2018, 9, 14)).first() }
+ assertEquals(2, attendance.size)
+ assertEquals(attendance[0].date, of(2018, 9, 10))
+ assertEquals(attendance[1].date, of(2018, 9, 14))
+ }
+
+ private fun getAttendanceEntity(
+ date: LocalDate,
+ excuseStatus: SentExcuseStatus
+ ) = Attendance(
+ studentId = 1,
+ diaryId = 2,
+ timeId = 3,
+ date = date,
+ number = 0,
+ subject = "",
+ name = "",
+ presence = false,
+ absence = false,
+ exemption = false,
+ lateness = false,
+ excused = false,
+ deleted = false,
+ excusable = false,
+ excuseStatus = excuseStatus.name
+ )
+}
diff --git a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/completedlessons/CompletedLessonsLocalTest.kt b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/completedlessons/CompletedLessonsLocalTest.kt
new file mode 100644
index 00000000..ca7d0b1b
--- /dev/null
+++ b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/completedlessons/CompletedLessonsLocalTest.kt
@@ -0,0 +1,59 @@
+package io.github.wulkanowy.data.repositories.completedlessons
+
+import androidx.room.Room
+import androidx.test.core.app.ApplicationProvider
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import io.github.wulkanowy.data.db.AppDatabase
+import io.github.wulkanowy.data.db.entities.CompletedLesson
+import io.github.wulkanowy.data.db.entities.Semester
+import kotlinx.coroutines.flow.first
+import kotlinx.coroutines.runBlocking
+import org.junit.After
+import org.junit.Before
+import org.junit.Test
+import org.junit.runner.RunWith
+import java.time.LocalDate
+import java.time.LocalDate.now
+import java.time.LocalDate.of
+import kotlin.test.assertEquals
+
+@RunWith(AndroidJUnit4::class)
+class CompletedLessonsLocalTest {
+
+ private lateinit var completedLessonsLocal: CompletedLessonsLocal
+
+ private lateinit var testDb: AppDatabase
+
+ @Before
+ fun createDb() {
+ testDb = Room
+ .inMemoryDatabaseBuilder(ApplicationProvider.getApplicationContext(), AppDatabase::class.java)
+ .build()
+ completedLessonsLocal = CompletedLessonsLocal(testDb.completedLessonsDao)
+ }
+
+ @After
+ fun closeDb() {
+ testDb.close()
+ }
+
+ @Test
+ fun saveAndReadTest() {
+ val list = listOf(
+ getCompletedLesson(of(2018, 9, 10), 1),
+ getCompletedLesson(of(2018, 9, 14), 2),
+ getCompletedLesson(of(2018, 9, 17), 3)
+ )
+ runBlocking { completedLessonsLocal.saveCompletedLessons(list) }
+
+ val semester = Semester(1, 2, "", 1, 3, 2019, now(), now(), 1, 1)
+ val completed = runBlocking { completedLessonsLocal.getCompletedLessons(semester, of(2018, 9, 10), of(2018, 9, 14)).first() }
+ assertEquals(2, completed.size)
+ assertEquals(completed[0].date, of(2018, 9, 10))
+ assertEquals(completed[1].date, of(2018, 9, 14))
+ }
+
+ private fun getCompletedLesson(date: LocalDate, number: Int): CompletedLesson {
+ return CompletedLesson(1, 2, date, number, "", "", "", "", "", "", "")
+ }
+}
diff --git a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/exam/ExamLocalTest.kt b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/exam/ExamLocalTest.kt
new file mode 100644
index 00000000..14b29c9f
--- /dev/null
+++ b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/exam/ExamLocalTest.kt
@@ -0,0 +1,52 @@
+package io.github.wulkanowy.data.repositories.exam
+
+import androidx.room.Room
+import androidx.test.core.app.ApplicationProvider
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import io.github.wulkanowy.data.db.AppDatabase
+import io.github.wulkanowy.data.db.entities.Exam
+import io.github.wulkanowy.data.db.entities.Semester
+import kotlinx.coroutines.flow.first
+import kotlinx.coroutines.runBlocking
+import org.junit.After
+import org.junit.Before
+import org.junit.Test
+import org.junit.runner.RunWith
+import java.time.LocalDate.now
+import java.time.LocalDate.of
+import kotlin.test.assertEquals
+
+@RunWith(AndroidJUnit4::class)
+class ExamLocalTest {
+
+ private lateinit var examLocal: ExamLocal
+
+ private lateinit var testDb: AppDatabase
+
+ @Before
+ fun createDb() {
+ testDb = Room.inMemoryDatabaseBuilder(ApplicationProvider.getApplicationContext(), AppDatabase::class.java).build()
+ examLocal = ExamLocal(testDb.examsDao)
+ }
+
+ @After
+ fun closeDb() {
+ testDb.close()
+ }
+
+ @Test
+ fun saveAndReadTest() {
+ val list = listOf(
+ Exam(1, 2, of(2018, 9, 10), now(), "", "", "", "", "", ""),
+ Exam(1, 2, of(2018, 9, 14), now(), "", "", "", "", "", ""),
+ Exam(1, 2, of(2018, 9, 17), now(), "", "", "", "", "", "")
+ )
+ runBlocking { examLocal.saveExams(list) }
+
+ val semester = Semester(1, 2, "", 1, 3, 2019, now(), now(), 1, 1)
+ val exams = runBlocking { examLocal.getExams(semester, of(2018, 9, 10), of(2018, 9, 14)).first() }
+ assertEquals(2, exams.size)
+ assertEquals(exams[0].date, of(2018, 9, 10))
+ assertEquals(exams[1].date, of(2018, 9, 14))
+ }
+}
diff --git a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/grade/GradeLocalTest.kt b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/grade/GradeLocalTest.kt
new file mode 100644
index 00000000..946ebf8e
--- /dev/null
+++ b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/grade/GradeLocalTest.kt
@@ -0,0 +1,55 @@
+package io.github.wulkanowy.data.repositories.grade
+
+import androidx.room.Room
+import androidx.test.core.app.ApplicationProvider
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import io.github.wulkanowy.data.db.AppDatabase
+import io.github.wulkanowy.data.db.entities.Semester
+import kotlinx.coroutines.flow.first
+import kotlinx.coroutines.runBlocking
+import org.junit.After
+import org.junit.Before
+import org.junit.Test
+import org.junit.runner.RunWith
+import java.time.LocalDate
+import java.time.LocalDate.now
+import kotlin.test.assertEquals
+
+@RunWith(AndroidJUnit4::class)
+class GradeLocalTest {
+
+ private lateinit var gradeLocal: GradeLocal
+
+ private lateinit var testDb: AppDatabase
+
+ @Before
+ fun createDb() {
+ testDb = Room
+ .inMemoryDatabaseBuilder(ApplicationProvider.getApplicationContext(), AppDatabase::class.java)
+ .build()
+ gradeLocal = GradeLocal(testDb.gradeDao, testDb.gradeSummaryDao)
+ }
+
+ @After
+ fun closeDb() {
+ testDb.close()
+ }
+
+ @Test
+ fun saveAndReadTest() {
+ val list = listOf(
+ createGradeLocal(5, 3.0, LocalDate.of(2018, 9, 10), "", 1),
+ createGradeLocal(4, 4.0, LocalDate.of(2019, 2, 27), "", 2),
+ createGradeLocal(3, 5.0, LocalDate.of(2019, 2, 28), "", 2)
+ )
+ runBlocking { gradeLocal.saveGrades(list) }
+
+ val semester = Semester(1, 2, "", 2019, 2, 1, now(), now(), 1, 1)
+
+ val grades = runBlocking { gradeLocal.getGradesDetails(semester).first() }
+
+ assertEquals(2, grades.size)
+ assertEquals(grades[0].date, LocalDate.of(2019, 2, 27))
+ assertEquals(grades[1].date, LocalDate.of(2019, 2, 28))
+ }
+}
diff --git a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/grade/GradeRepositoryTest.kt b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/grade/GradeRepositoryTest.kt
new file mode 100644
index 00000000..5cf9c219
--- /dev/null
+++ b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/grade/GradeRepositoryTest.kt
@@ -0,0 +1,221 @@
+package io.github.wulkanowy.data.repositories.grade
+
+import android.os.Build.VERSION_CODES.P
+import androidx.room.Room
+import androidx.test.core.app.ApplicationProvider.getApplicationContext
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import androidx.test.filters.SdkSuppress
+import io.github.wulkanowy.data.Status
+import io.github.wulkanowy.data.db.AppDatabase
+import io.github.wulkanowy.data.db.entities.Grade
+import io.github.wulkanowy.data.db.entities.Semester
+import io.github.wulkanowy.data.db.entities.Student
+import io.github.wulkanowy.sdk.Sdk
+import io.mockk.MockKAnnotations
+import io.mockk.coEvery
+import io.mockk.every
+import io.mockk.impl.annotations.MockK
+import kotlinx.coroutines.flow.filter
+import kotlinx.coroutines.flow.first
+import kotlinx.coroutines.runBlocking
+import org.junit.After
+import org.junit.Before
+import org.junit.Test
+import org.junit.runner.RunWith
+import java.time.LocalDate.of
+import java.time.LocalDateTime
+import kotlin.test.assertEquals
+import kotlin.test.assertFalse
+import kotlin.test.assertTrue
+
+@SdkSuppress(minSdkVersion = P)
+@RunWith(AndroidJUnit4::class)
+class GradeRepositoryTest {
+
+ @MockK
+ private lateinit var semesterMock: Semester
+
+ private lateinit var studentMock: Student
+
+ @MockK
+ private lateinit var gradeRemote: GradeRemote
+
+ private lateinit var gradeLocal: GradeLocal
+
+ private lateinit var testDb: AppDatabase
+
+ @Before
+ fun initApi() {
+ MockKAnnotations.init(this)
+ testDb = Room.inMemoryDatabaseBuilder(getApplicationContext(), AppDatabase::class.java).build()
+ gradeLocal = GradeLocal(testDb.gradeDao, testDb.gradeSummaryDao)
+ studentMock = getStudentMock()
+
+ every { semesterMock.studentId } returns 1
+ every { semesterMock.diaryId } returns 1
+ every { semesterMock.schoolYear } returns 2019
+ every { semesterMock.semesterId } returns 1
+ }
+
+ @After
+ fun closeDb() {
+ testDb.close()
+ }
+
+ @Test
+ fun markOlderThanRegisterDateAsRead() {
+ coEvery { gradeRemote.getGrades(studentMock, semesterMock) } returns (listOf(
+ createGradeLocal(5, 4.0, of(2019, 2, 25), "Ocena pojawiła się"),
+ createGradeLocal(5, 4.0, of(2019, 2, 26), "przed zalogowanie w aplikacji"),
+ createGradeLocal(5, 4.0, of(2019, 2, 27), "Ocena z dnia logowania"),
+ createGradeLocal(5, 4.0, of(2019, 2, 28), "Ocena jeszcze nowsza")
+ ) to emptyList())
+
+ val grades = runBlocking {
+ GradeRepository(gradeLocal, gradeRemote)
+ .getGrades(studentMock, semesterMock, true)
+ .filter { it.status == Status.SUCCESS }.first().data!!.first.sortedByDescending { it.date }
+ }
+
+ assertFalse { grades[0].isRead }
+ assertFalse { grades[1].isRead }
+ assertTrue { grades[2].isRead }
+ assertTrue { grades[3].isRead }
+ }
+
+ @Test
+ fun mitigateOldGradesNotifications() {
+ val list = listOf(
+ createGradeLocal(5, 3.0, of(2019, 2, 25), "Jedna ocena"),
+ createGradeLocal(4, 4.0, of(2019, 2, 26), "Druga"),
+ createGradeLocal(3, 5.0, of(2019, 2, 27), "Trzecia")
+ )
+ runBlocking { gradeLocal.saveGrades(list) }
+
+ coEvery { gradeRemote.getGrades(studentMock, semesterMock) } returns (listOf(
+ createGradeLocal(5, 2.0, of(2019, 2, 25), "Ocena ma datę, jest inna, ale nie zostanie powiadomiona"),
+ createGradeLocal(4, 3.0, of(2019, 2, 26), "starszą niż ostatnia lokalnie"),
+ createGradeLocal(3, 4.0, of(2019, 2, 27), "Ta jest z tego samego dnia co ostatnia lokalnie"),
+ createGradeLocal(2, 5.0, of(2019, 2, 28), "Ta jest już w ogóle nowa")
+ ) to emptyList())
+
+ val grades = runBlocking {
+ GradeRepository(gradeLocal, gradeRemote)
+ .getGrades(studentMock, semesterMock, true)
+ .filter { it.status == Status.SUCCESS }.first().data!!.first.sortedByDescending { it.date }
+ }
+
+ assertFalse { grades[0].isRead }
+ assertFalse { grades[1].isRead }
+ assertTrue { grades[2].isRead }
+ assertTrue { grades[3].isRead }
+ }
+
+ @Test
+ fun subtractLocaleDuplicateGrades() {
+ val list = listOf(
+ createGradeLocal(5, 3.0, of(2019, 2, 25), "Taka sama ocena"),
+ createGradeLocal(5, 3.0, of(2019, 2, 25), "Taka sama ocena"),
+ createGradeLocal(3, 5.0, of(2019, 2, 26), "Jakaś inna ocena")
+ )
+ runBlocking { gradeLocal.saveGrades(list) }
+
+ coEvery { gradeRemote.getGrades(studentMock, semesterMock) } returns (listOf(
+ createGradeLocal(5, 3.0, of(2019, 2, 25), "Taka sama ocena"),
+ createGradeLocal(3, 5.0, of(2019, 2, 26), "Jakaś inna ocena")
+ ) to emptyList())
+
+ val grades = runBlocking {
+ GradeRepository(gradeLocal, gradeRemote)
+ .getGrades(studentMock, semesterMock, true)
+ .filter { it.status == Status.SUCCESS }.first().data!!
+ }
+
+ assertEquals(2, grades.first.size)
+ }
+
+ @Test
+ fun subtractRemoteDuplicateGrades() {
+ val list = listOf(
+ createGradeLocal(5, 3.0, of(2019, 2, 25), "Taka sama ocena"),
+ createGradeLocal(3, 5.0, of(2019, 2, 26), "Jakaś inna ocena")
+ )
+ runBlocking { gradeLocal.saveGrades(list) }
+
+ coEvery { gradeRemote.getGrades(studentMock, semesterMock) } returns (listOf(
+ createGradeLocal(5, 3.0, of(2019, 2, 25), "Taka sama ocena"),
+ createGradeLocal(5, 3.0, of(2019, 2, 25), "Taka sama ocena"),
+ createGradeLocal(3, 5.0, of(2019, 2, 26), "Jakaś inna ocena")
+ ) to emptyList())
+
+ val grades = runBlocking {
+ GradeRepository(gradeLocal, gradeRemote)
+ .getGrades(studentMock, semesterMock, true)
+ .filter { it.status == Status.SUCCESS }.first().data!!
+ }
+
+ assertEquals(3, grades.first.size)
+ }
+
+ @Test
+ fun emptyLocal() {
+ runBlocking { gradeLocal.saveGrades(listOf()) }
+
+ coEvery { gradeRemote.getGrades(studentMock, semesterMock) } returns (listOf(
+ createGradeLocal(5, 3.0, of(2019, 2, 25), "Taka sama ocena"),
+ createGradeLocal(5, 3.0, of(2019, 2, 25), "Taka sama ocena"),
+ createGradeLocal(3, 5.0, of(2019, 2, 26), "Jakaś inna ocena")
+ ) to emptyList())
+
+ val grades = runBlocking {
+ GradeRepository(gradeLocal, gradeRemote)
+ .getGrades(studentMock, semesterMock, true)
+ .filter { it.status == Status.SUCCESS }.first().data!!
+ }
+
+ assertEquals(3, grades.first.size)
+ }
+
+ @Test
+ fun emptyRemote() {
+ val list = listOf(
+ createGradeLocal(5, 3.0, of(2019, 2, 25), "Taka sama ocena"),
+ createGradeLocal(3, 5.0, of(2019, 2, 26), "Jakaś inna ocena")
+ )
+ runBlocking { gradeLocal.saveGrades(list) }
+
+ coEvery { gradeRemote.getGrades(studentMock, semesterMock) } returns (emptyList() to emptyList())
+
+ val grades = runBlocking {
+ GradeRepository(gradeLocal, gradeRemote)
+ .getGrades(studentMock, semesterMock, true)
+ .filter { it.status == Status.SUCCESS }.first().data!!
+ }
+
+ assertEquals(0, grades.first.size)
+ }
+
+ private fun getStudentMock() = Student(
+ scrapperBaseUrl = "http://fakelog.cf",
+ email = "jan@fakelog.cf",
+ certificateKey = "",
+ classId = 0,
+ className = "",
+ isCurrent = false,
+ isParent = false,
+ loginMode = Sdk.Mode.SCRAPPER.name,
+ loginType = "STANDARD",
+ mobileBaseUrl = "",
+ password = "",
+ privateKey = "",
+ registrationDate = LocalDateTime.of(2019, 2, 27, 12, 0),
+ schoolName = "",
+ schoolShortName = "test",
+ schoolSymbol = "",
+ studentId = 0,
+ studentName = "",
+ symbol = "",
+ userLoginId = 0,
+ userName = ""
+ )
+}
diff --git a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/grade/TestGradeEntityCreator.kt b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/grade/TestGradeEntityCreator.kt
new file mode 100644
index 00000000..629c2432
--- /dev/null
+++ b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/grade/TestGradeEntityCreator.kt
@@ -0,0 +1,41 @@
+package io.github.wulkanowy.data.repositories.grade
+
+import java.time.LocalDate
+import io.github.wulkanowy.sdk.pojo.Grade as GradeRemote
+import io.github.wulkanowy.data.db.entities.Grade as GradeLocal
+
+fun createGradeLocal(value: Int, weight: Double, date: LocalDate, desc: String, semesterId: Int = 1): GradeLocal {
+ return GradeLocal(
+ semesterId = semesterId,
+ studentId = 1,
+ modifier = .0,
+ teacher = "",
+ subject = "",
+ date = date,
+ color = "",
+ comment = "",
+ description = desc,
+ entry = "",
+ gradeSymbol = "",
+ value = value.toDouble(),
+ weight = "",
+ weightValue = weight
+ )
+}
+
+fun createGradeApi(value: Int, weight: Double, date: LocalDate, desc: String): GradeRemote {
+ return GradeRemote(
+ subject = "",
+ color = "",
+ comment = "",
+ date = date,
+ description = desc,
+ entry = "",
+ modifier = .0,
+ symbol = "",
+ teacher = "",
+ value = value.toDouble(),
+ weight = weight.toString(),
+ weightValue = weight
+ )
+}
diff --git a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/gradestatistics/GradeStatisticsLocalTest.kt b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/gradestatistics/GradeStatisticsLocalTest.kt
new file mode 100644
index 00000000..197d2d0e
--- /dev/null
+++ b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/gradestatistics/GradeStatisticsLocalTest.kt
@@ -0,0 +1,112 @@
+package io.github.wulkanowy.data.repositories.gradestatistics
+
+import androidx.room.Room
+import androidx.test.core.app.ApplicationProvider
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import io.github.wulkanowy.data.db.AppDatabase
+import io.github.wulkanowy.data.db.entities.GradePointsStatistics
+import io.github.wulkanowy.data.db.entities.GradeStatistics
+import io.github.wulkanowy.data.db.entities.Semester
+import kotlinx.coroutines.flow.first
+import kotlinx.coroutines.runBlocking
+import org.junit.After
+import org.junit.Before
+import org.junit.Test
+import org.junit.runner.RunWith
+import java.time.LocalDate.now
+import kotlin.test.assertEquals
+
+@RunWith(AndroidJUnit4::class)
+class GradeStatisticsLocalTest {
+
+ private lateinit var gradeStatisticsLocal: GradeStatisticsLocal
+
+ private lateinit var testDb: AppDatabase
+
+ @Before
+ fun createDb() {
+ testDb = Room.inMemoryDatabaseBuilder(ApplicationProvider.getApplicationContext(), AppDatabase::class.java)
+ .build()
+ gradeStatisticsLocal = GradeStatisticsLocal(testDb.gradeStatistics, testDb.gradePointsStatistics)
+ }
+
+ @After
+ fun closeDb() {
+ testDb.close()
+ }
+
+ @Test
+ fun saveAndRead_subject() {
+ val list = listOf(
+ getGradeStatistics("Matematyka", 2, 1),
+ getGradeStatistics("Fizyka", 1, 2)
+ )
+ runBlocking { gradeStatisticsLocal.saveGradesStatistics(list) }
+
+ val stats = runBlocking { gradeStatisticsLocal.getGradesStatistics(getSemester(), false).first() }
+ assertEquals(1, stats.size)
+ assertEquals(stats[0].subject, "Matematyka")
+ }
+
+ @Test
+ fun saveAndRead_all() {
+ val list = listOf(
+ getGradeStatistics("Matematyka", 2, 1),
+ getGradeStatistics("Chemia", 2, 1),
+ getGradeStatistics("Fizyka", 1, 2)
+ )
+ runBlocking { gradeStatisticsLocal.saveGradesStatistics(list) }
+
+ val stats = runBlocking { gradeStatisticsLocal.getGradesStatistics(getSemester(), false).first() }
+ assertEquals(2, stats.size)
+// assertEquals(3, stats.size)
+// assertEquals(stats[0].subject, "Wszystkie") // now in main repo
+ assertEquals(stats[0].subject, "Matematyka")
+ assertEquals(stats[1].subject, "Chemia")
+ }
+
+ @Test
+ fun saveAndRead_points() {
+ val list = listOf(
+ getGradePointsStatistics("Matematyka", 2, 1),
+ getGradePointsStatistics("Chemia", 2, 1),
+ getGradePointsStatistics("Fizyka", 1, 2)
+ )
+ runBlocking { gradeStatisticsLocal.saveGradesPointsStatistics(list) }
+
+ val stats = runBlocking { gradeStatisticsLocal.getGradesPointsStatistics(getSemester()).first() }
+ with(stats[0]) {
+ assertEquals(subject, "Matematyka")
+ assertEquals(others, 5.0)
+ assertEquals(student, 5.0)
+ }
+ }
+
+ @Test
+ fun saveAndRead_subjectEmpty() {
+ runBlocking { gradeStatisticsLocal.saveGradesPointsStatistics(listOf()) }
+
+ val stats = runBlocking { gradeStatisticsLocal.getGradesPointsStatistics(getSemester()).first() }
+ assertEquals(emptyList(), stats)
+ }
+
+ @Test
+ fun saveAndRead_allEmpty() {
+ runBlocking { gradeStatisticsLocal.saveGradesPointsStatistics(listOf()) }
+
+ val stats = runBlocking { gradeStatisticsLocal.getGradesPointsStatistics(getSemester()).first() }
+ assertEquals(emptyList(), stats)
+ }
+
+ private fun getSemester(): Semester {
+ return Semester(2, 2, "", 2019, 1, 2, now(), now(), 1, 1)
+ }
+
+ private fun getGradeStatistics(subject: String, studentId: Int, semesterId: Int): GradeStatistics {
+ return GradeStatistics(studentId, semesterId, subject, 5, 5, false)
+ }
+
+ private fun getGradePointsStatistics(subject: String, studentId: Int, semesterId: Int): GradePointsStatistics {
+ return GradePointsStatistics(studentId, semesterId, subject, 5.0, 5.0)
+ }
+}
diff --git a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/luckynumber/LuckyNumberLocalTest.kt b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/luckynumber/LuckyNumberLocalTest.kt
new file mode 100644
index 00000000..ca38b1fe
--- /dev/null
+++ b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/luckynumber/LuckyNumberLocalTest.kt
@@ -0,0 +1,51 @@
+package io.github.wulkanowy.data.repositories.luckynumber
+
+import androidx.room.Room
+import androidx.test.core.app.ApplicationProvider
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import io.github.wulkanowy.data.db.AppDatabase
+import io.github.wulkanowy.data.db.entities.LuckyNumber
+import io.github.wulkanowy.data.db.entities.Student
+import kotlinx.coroutines.flow.first
+import kotlinx.coroutines.runBlocking
+import org.junit.After
+import org.junit.Before
+import org.junit.Test
+import org.junit.runner.RunWith
+import java.time.LocalDate
+import java.time.LocalDateTime.now
+import kotlin.test.assertEquals
+
+@RunWith(AndroidJUnit4::class)
+class LuckyNumberLocalTest {
+
+ private lateinit var luckyNumberLocal: LuckyNumberLocal
+
+ private lateinit var testDb: AppDatabase
+
+ @Before
+ fun createDb() {
+ testDb = Room
+ .inMemoryDatabaseBuilder(ApplicationProvider.getApplicationContext(), AppDatabase::class.java)
+ .build()
+ luckyNumberLocal = LuckyNumberLocal(testDb.luckyNumberDao)
+ }
+
+ @After
+ fun closeDb() {
+ testDb.close()
+ }
+
+ @Test
+ fun saveAndReadTest() {
+ val number = LuckyNumber(1, LocalDate.of(2019, 1, 20), 14)
+ runBlocking { luckyNumberLocal.saveLuckyNumber(number) }
+
+ val student = Student("", "", "", "", "", "", false, "", "", "", 1, 1, "", "", "", "", "", "", 1, false, now())
+ val luckyNumber = runBlocking { luckyNumberLocal.getLuckyNumber(student, LocalDate.of(2019, 1, 20)).first() }
+
+ assertEquals(1, luckyNumber?.studentId)
+ assertEquals(LocalDate.of(2019, 1, 20), luckyNumber?.date)
+ assertEquals(14, luckyNumber?.luckyNumber)
+ }
+}
diff --git a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/recipient/RecipientLocalTest.kt b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/recipient/RecipientLocalTest.kt
new file mode 100644
index 00000000..6bd1959b
--- /dev/null
+++ b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/recipient/RecipientLocalTest.kt
@@ -0,0 +1,65 @@
+package io.github.wulkanowy.data.repositories.recipient
+
+import androidx.room.Room
+import androidx.test.core.app.ApplicationProvider
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import io.github.wulkanowy.data.db.AppDatabase
+import io.github.wulkanowy.data.db.entities.Recipient
+import io.github.wulkanowy.data.db.entities.ReportingUnit
+import io.github.wulkanowy.data.db.entities.Student
+import kotlinx.coroutines.runBlocking
+import org.junit.After
+import org.junit.Before
+import org.junit.Test
+import org.junit.runner.RunWith
+import java.time.LocalDateTime
+import kotlin.test.assertEquals
+
+@RunWith(AndroidJUnit4::class)
+class RecipientLocalTest {
+
+ private lateinit var recipientLocal: RecipientLocal
+
+ private lateinit var testDb: AppDatabase
+
+ @Before
+ fun createDb() {
+ testDb = Room.inMemoryDatabaseBuilder(ApplicationProvider.getApplicationContext(), AppDatabase::class.java)
+ .build()
+ recipientLocal = RecipientLocal(testDb.recipientDao)
+ }
+
+ @After
+ fun closeDb() {
+ testDb.close()
+ }
+
+ @Test
+ fun saveAndReadTest() {
+ val list = listOf(
+ Recipient(1, "2rPracownik", "Kowalski Jan", "Kowalski Jan [KJ] - Pracownik (Fake123456)", 3, 4, 2, "hash"),
+ Recipient(1, "3rPracownik", "Kowalska Karolina", "Kowalska Karolina [KK] - Pracownik (Fake123456)", 4, 4, 2, "hash"),
+ Recipient(1, "4rPracownik", "Krupa Stanisław", "Krupa Stanisław [KS] - Uczeń (Fake123456)", 5, 4, 1, "hash")
+ )
+ runBlocking { recipientLocal.saveRecipients(list) }
+
+ val student = Student("fakelog.cf", "AUTO", "", "", "", "", false, "", "", "", 1, 0, "", "", "", "", "", "", 1, true, LocalDateTime.now())
+ val recipients = runBlocking {
+ recipientLocal.getRecipients(
+ student = student,
+ role = 2,
+ unit = ReportingUnit(1, 4, "", 0, "", emptyList())
+ )
+ }
+
+ assertEquals(2, recipients.size)
+ assertEquals(1, recipients[0].studentId)
+ assertEquals("3rPracownik", recipients[1].realId)
+ assertEquals("Kowalski Jan", recipients[0].name)
+ assertEquals("Kowalska Karolina [KK] - Pracownik (Fake123456)", recipients[1].realName)
+ assertEquals(3, recipients[0].loginId)
+ assertEquals(4, recipients[1].unitId)
+ assertEquals(2, recipients[0].role)
+ assertEquals("hash", recipients[1].hash)
+ }
+}
diff --git a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/student/StudentLocalTest.kt b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/student/StudentLocalTest.kt
new file mode 100644
index 00000000..d68f15a8
--- /dev/null
+++ b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/student/StudentLocalTest.kt
@@ -0,0 +1,46 @@
+package io.github.wulkanowy.data.repositories.student
+
+import android.content.Context
+import androidx.room.Room
+import androidx.test.core.app.ApplicationProvider
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import io.github.wulkanowy.data.TestDispatchersProvider
+import io.github.wulkanowy.data.db.AppDatabase
+import io.github.wulkanowy.data.repositories.getStudent
+import kotlinx.coroutines.runBlocking
+import org.junit.After
+import org.junit.Before
+import org.junit.Test
+import org.junit.runner.RunWith
+import kotlin.test.assertEquals
+
+@RunWith(AndroidJUnit4::class)
+class StudentLocalTest {
+
+ private lateinit var studentLocal: StudentLocal
+
+ private lateinit var testDb: AppDatabase
+
+ private val student = getStudent()
+
+ @Before
+ fun createDb() {
+ val context = ApplicationProvider.getApplicationContext()
+ testDb = Room.inMemoryDatabaseBuilder(context, AppDatabase::class.java)
+ .build()
+ studentLocal = StudentLocal(testDb.studentDao, TestDispatchersProvider(), context)
+ }
+
+ @After
+ fun closeDb() {
+ testDb.close()
+ }
+
+ @Test
+ fun saveAndReadTest() {
+ runBlocking { studentLocal.saveStudents(listOf(student)) }
+
+ val student = runBlocking { studentLocal.getCurrentStudent(true) }
+ assertEquals("23", student?.schoolSymbol)
+ }
+}
diff --git a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/timetable/TestTimetableEntityCreator.kt b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/timetable/TestTimetableEntityCreator.kt
new file mode 100644
index 00000000..dddf6464
--- /dev/null
+++ b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/timetable/TestTimetableEntityCreator.kt
@@ -0,0 +1,48 @@
+package io.github.wulkanowy.data.repositories.timetable
+
+import java.time.LocalDateTime
+import java.time.LocalDateTime.now
+import io.github.wulkanowy.data.db.entities.Timetable as TimetableLocal
+import io.github.wulkanowy.sdk.pojo.Timetable as TimetableRemote
+
+fun createTimetableLocal(start: LocalDateTime, number: Int, room: String = "", subject: String = "", teacher: String = "", changes: Boolean = false): TimetableLocal {
+ return TimetableLocal(
+ studentId = 1,
+ diaryId = 2,
+ number = number,
+ start = start,
+ end = now(),
+ date = start.toLocalDate(),
+ subject = subject,
+ subjectOld = "",
+ group = "",
+ room = room,
+ roomOld = "",
+ teacher = teacher,
+ teacherOld = "",
+ info = "",
+ isStudentPlan = true,
+ changes = changes,
+ canceled = false
+ )
+}
+
+fun createTimetableRemote(start: LocalDateTime, number: Int = 1, room: String = "", subject: String = "", teacher: String = "", changes: Boolean = false): TimetableRemote {
+ return TimetableRemote(
+ number = number,
+ start = start,
+ end = start.plusMinutes(45),
+ date = start.toLocalDate(),
+ subject = subject,
+ group = "",
+ room = room,
+ teacher = teacher,
+ info = "",
+ changes = changes,
+ canceled = false,
+ roomOld = "",
+ subjectOld = "",
+ teacherOld = "",
+ studentPlan = true
+ )
+}
diff --git a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/timetable/TimetableLocalTest.kt b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/timetable/TimetableLocalTest.kt
new file mode 100644
index 00000000..e793212e
--- /dev/null
+++ b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/timetable/TimetableLocalTest.kt
@@ -0,0 +1,59 @@
+package io.github.wulkanowy.data.repositories.timetable
+
+import androidx.room.Room
+import androidx.test.core.app.ApplicationProvider
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import io.github.wulkanowy.data.db.AppDatabase
+import io.github.wulkanowy.data.db.entities.Semester
+import kotlinx.coroutines.flow.first
+import kotlinx.coroutines.runBlocking
+import org.junit.After
+import org.junit.Before
+import org.junit.Test
+import org.junit.runner.RunWith
+import java.time.LocalDate
+import java.time.LocalDateTime.of
+import kotlin.test.assertEquals
+
+@RunWith(AndroidJUnit4::class)
+class TimetableLocalTest {
+
+ private lateinit var timetableDb: TimetableLocal
+
+ private lateinit var testDb: AppDatabase
+
+ @Before
+ fun createDb() {
+ testDb = Room.inMemoryDatabaseBuilder(ApplicationProvider.getApplicationContext(), AppDatabase::class.java)
+ .build()
+ timetableDb = TimetableLocal(testDb.timetableDao)
+ }
+
+ @After
+ fun closeDb() {
+ testDb.close()
+ }
+
+ @Test
+ fun saveAndReadTest() {
+ val list = listOf(
+ createTimetableLocal(of(2018, 9, 10, 0, 0, 0), 1),
+ createTimetableLocal(of(2018, 9, 14, 0, 0, 0), 1),
+ createTimetableLocal(of(2018, 9, 17, 0, 0, 0), 1)
+ )
+ runBlocking { timetableDb.saveTimetable(list) }
+
+ val semester = Semester(1, 2, "", 1, 1, 2019, LocalDate.now(), LocalDate.now(), 1, 1)
+ val exams = runBlocking {
+ timetableDb.getTimetable(
+ semester = semester,
+ startDate = LocalDate.of(2018, 9, 10),
+ endDate = LocalDate.of(2018, 9, 14)
+ ).first()
+ }
+
+ assertEquals(2, exams.size)
+ assertEquals(exams[0].date, LocalDate.of(2018, 9, 10))
+ assertEquals(exams[1].date, LocalDate.of(2018, 9, 14))
+ }
+}
diff --git a/app/src/androidTest/java/io/github/wulkanowy/data/repositories/timetable/TimetableRepositoryTest.kt b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/timetable/TimetableRepositoryTest.kt
new file mode 100644
index 00000000..1bd3c467
--- /dev/null
+++ b/app/src/androidTest/java/io/github/wulkanowy/data/repositories/timetable/TimetableRepositoryTest.kt
@@ -0,0 +1,155 @@
+package io.github.wulkanowy.data.repositories.timetable
+
+import android.os.Build.VERSION_CODES.P
+import androidx.room.Room
+import androidx.test.core.app.ApplicationProvider.getApplicationContext
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import androidx.test.filters.SdkSuppress
+import io.github.wulkanowy.data.Status
+import io.github.wulkanowy.data.db.AppDatabase
+import io.github.wulkanowy.data.repositories.getSemester
+import io.github.wulkanowy.data.repositories.getStudent
+import io.github.wulkanowy.services.alarm.TimetableNotificationSchedulerHelper
+import io.mockk.MockKAnnotations
+import io.mockk.coEvery
+import io.mockk.impl.annotations.MockK
+import kotlinx.coroutines.flow.filter
+import kotlinx.coroutines.flow.first
+import kotlinx.coroutines.runBlocking
+import org.junit.After
+import org.junit.Before
+import org.junit.Test
+import org.junit.runner.RunWith
+import java.time.LocalDate
+import java.time.LocalDateTime.of
+import kotlin.test.assertEquals
+
+@SdkSuppress(minSdkVersion = P)
+@RunWith(AndroidJUnit4::class)
+class TimetableRepositoryTest {
+
+ @MockK(relaxed = true)
+ private lateinit var timetableNotificationSchedulerHelper: TimetableNotificationSchedulerHelper
+
+ @MockK
+ private lateinit var timetableRemote: TimetableRemote
+
+ private lateinit var timetableLocal: TimetableLocal
+
+ private lateinit var testDb: AppDatabase
+
+ private val student = getStudent()
+
+ private val semester = getSemester()
+
+ @Before
+ fun initApi() {
+ MockKAnnotations.init(this)
+ testDb = Room.inMemoryDatabaseBuilder(getApplicationContext(), AppDatabase::class.java).build()
+ timetableLocal = TimetableLocal(testDb.timetableDao)
+ }
+
+ @After
+ fun closeDb() {
+ testDb.close()
+ }
+
+ @Test
+ fun copyRoomToCompletedFromPrevious() {
+ runBlocking {
+ timetableLocal.saveTimetable(listOf(
+ createTimetableLocal(of(2019, 3, 5, 8, 0), 1, "123", "Przyroda"),
+ createTimetableLocal(of(2019, 3, 5, 8, 50), 2, "321", "Religia"),
+ createTimetableLocal(of(2019, 3, 5, 9, 40), 3, "213", "W-F"),
+ createTimetableLocal(of(2019, 3, 5, 10, 30), 3, "213", "W-F", "Jan Kowalski")
+ ))
+ }
+
+ coEvery { timetableRemote.getTimetable(student, semester, any(), any()) } returns listOf(
+ createTimetableLocal(of(2019, 3, 5, 8, 0), 1, "", "Przyroda"),
+ createTimetableLocal(of(2019, 3, 5, 8, 50), 2, "", "Religia"),
+ createTimetableLocal(of(2019, 3, 5, 9, 40), 3, "", "W-F"),
+ createTimetableLocal(of(2019, 3, 5, 10, 30), 4, "", "W-F")
+ )
+
+ val lessons = runBlocking {
+ TimetableRepository(timetableLocal, timetableRemote, timetableNotificationSchedulerHelper).getTimetable(
+ student = student,
+ semester = semester,
+ start = LocalDate.of(2019, 3, 5),
+ end = LocalDate.of(2019, 3, 5),
+ forceRefresh = true
+ ).filter { it.status == Status.SUCCESS }.first().data.orEmpty()
+ }
+
+ assertEquals(4, lessons.size)
+ assertEquals("123", lessons[0].room)
+ assertEquals("321", lessons[1].room)
+ assertEquals("213", lessons[2].room)
+ }
+
+ @Test
+ fun copyTeacherToCompletedFromPrevious() {
+ val list = listOf(
+ createTimetableLocal(of(2019, 12, 23, 8, 0), 1, "123", "Matematyka", "Paweł Poniedziałkowski", false),
+ createTimetableLocal(of(2019, 12, 23, 8, 50), 2, "124", "Matematyka", "Paweł Poniedziałkowski", false),
+ createTimetableLocal(of(2019, 12, 23, 9, 40), 3, "125", "Język polski", "Joanna Wtorkowska", true),
+ createTimetableLocal(of(2019, 12, 23, 10, 40), 4, "126", "Język polski", "Joanna Wtorkowska", true),
+
+ createTimetableLocal(of(2019, 12, 24, 8, 0), 1, "123", "Język polski", "Joanna Wtorkowska", false),
+ createTimetableLocal(of(2019, 12, 24, 8, 50), 2, "124", "Język polski", "Joanna Wtorkowska", false),
+ createTimetableLocal(of(2019, 12, 24, 9, 40), 3, "125", "Język polski", "Joanna Środowska", true),
+ createTimetableLocal(of(2019, 12, 24, 10, 40), 4, "126", "Język polski", "Joanna Środowska", true),
+
+ createTimetableLocal(of(2019, 12, 25, 8, 0), 1, "123", "Matematyka", "", false),
+ createTimetableLocal(of(2019, 12, 25, 8, 50), 2, "124", "Matematyka", "", false),
+ createTimetableLocal(of(2019, 12, 25, 9, 40), 3, "125", "Matematyka", "", true),
+ createTimetableLocal(of(2019, 12, 25, 10, 40), 4, "126", "Matematyka", "", true)
+ )
+ runBlocking { timetableLocal.saveTimetable(list) }
+
+ coEvery { timetableRemote.getTimetable(student, semester, any(), any()) } returns listOf(
+ createTimetableLocal(of(2019, 12, 23, 8, 0), 1, "123", "Matematyka", "Paweł Poniedziałkowski", false),
+ createTimetableLocal(of(2019, 12, 23, 8, 50), 2, "124", "Matematyka", "Jakub Wtorkowski", true),
+ createTimetableLocal(of(2019, 12, 23, 9, 40), 3, "125", "Język polski", "Joanna Poniedziałkowska", false),
+ createTimetableLocal(of(2019, 12, 23, 10, 40), 4, "126", "Język polski", "Joanna Wtorkowska", true),
+
+ createTimetableLocal(of(2019, 12, 24, 8, 0), 1, "123", "Język polski", "", false),
+ createTimetableLocal(of(2019, 12, 24, 8, 50), 2, "124", "Język polski", "", true),
+ createTimetableLocal(of(2019, 12, 24, 9, 40), 3, "125", "Język polski", "", false),
+ createTimetableLocal(of(2019, 12, 24, 10, 40), 4, "126", "Język polski", "", true),
+
+ createTimetableLocal(of(2019, 12, 25, 8, 0), 1, "123", "Matematyka", "Paweł Środowski", false),
+ createTimetableLocal(of(2019, 12, 25, 8, 50), 2, "124", "Matematyka", "Paweł Czwartkowski", true),
+ createTimetableLocal(of(2019, 12, 25, 9, 40), 3, "125", "Matematyka", "Paweł Środowski", false),
+ createTimetableLocal(of(2019, 12, 25, 10, 40), 4, "126", "Matematyka", "Paweł Czwartkowski", true)
+ )
+
+ val lessons = runBlocking {
+ TimetableRepository(timetableLocal, timetableRemote, timetableNotificationSchedulerHelper).getTimetable(
+ student = student,
+ semester = semester,
+ start = LocalDate.of(2019, 12, 23),
+ end = LocalDate.of(2019, 12, 25),
+ forceRefresh = true
+ ).filter { it.status == Status.SUCCESS }.first().data.orEmpty()
+ }
+
+ assertEquals(12, lessons.size)
+
+ assertEquals("Paweł Poniedziałkowski", lessons[0].teacher)
+ assertEquals("Jakub Wtorkowski", lessons[1].teacher)
+ assertEquals("Joanna Poniedziałkowska", lessons[2].teacher)
+ assertEquals("Joanna Wtorkowska", lessons[3].teacher)
+
+ assertEquals("Joanna Wtorkowska", lessons[4].teacher)
+ assertEquals("", lessons[5].teacher)
+ assertEquals("", lessons[6].teacher)
+ assertEquals("", lessons[7].teacher)
+
+ assertEquals("Paweł Środowski", lessons[8].teacher)
+ assertEquals("Paweł Czwartkowski", lessons[9].teacher)
+ assertEquals("Paweł Środowski", lessons[10].teacher)
+ assertEquals("Paweł Czwartkowski", lessons[11].teacher)
+ }
+}
diff --git a/app/src/debug/agconnect-services.json b/app/src/debug/agconnect-services.json
deleted file mode 100644
index 48192df0..00000000
--- a/app/src/debug/agconnect-services.json
+++ /dev/null
@@ -1,33 +0,0 @@
-{
- "agcgw":{
- "backurl":"connect-dre.dbankcloud.cn",
- "url":"connect-dre.hispace.hicloud.com"
- },
- "client":{
- "cp_id":"890048000024105546",
- "product_id":"",
- "client_id":"",
- "client_secret":"",
- "app_id":"101440411",
- "package_name":"io.github.wulkanowy.dev",
- "api_key":""
- },
- "service":{
- "analytics":{
- "collector_url":"datacollector-dre.dt.hicloud.com,datacollector-dre.dt.dbankcloud.cn",
- "resource_id":"p1",
- "channel_id":""
- },
- "search":{
- "url":"https://search-dre.cloud.huawei.com"
- },
- "cloudstorage":{
- "storage_url":"https://ops-dre.agcstorage.link"
- },
- "ml":{
- "mlservice_url":"ml-api-dre.ai.dbankcloud.com,ml-api-dre.ai.dbankcloud.cn"
- }
- },
- "region":"DE",
- "configuration_version":"1.0"
-}
diff --git a/app/src/debug/res/drawable-anydpi-v24/ic_stat_timetable.xml b/app/src/debug/res/drawable-anydpi-v24/ic_stat_timetable.xml
deleted file mode 100644
index ac99d4a8..00000000
--- a/app/src/debug/res/drawable-anydpi-v24/ic_stat_timetable.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
diff --git a/app/src/debug/res/drawable-hdpi/ic_stat_timetable.png b/app/src/debug/res/drawable-hdpi/ic_stat_timetable.png
deleted file mode 100644
index 10b27cee..00000000
Binary files a/app/src/debug/res/drawable-hdpi/ic_stat_timetable.png and /dev/null differ
diff --git a/app/src/debug/res/drawable-mdpi/ic_stat_timetable.png b/app/src/debug/res/drawable-mdpi/ic_stat_timetable.png
deleted file mode 100644
index db5747b0..00000000
Binary files a/app/src/debug/res/drawable-mdpi/ic_stat_timetable.png and /dev/null differ
diff --git a/app/src/debug/res/drawable-xhdpi/ic_stat_timetable.png b/app/src/debug/res/drawable-xhdpi/ic_stat_timetable.png
deleted file mode 100644
index 8d985829..00000000
Binary files a/app/src/debug/res/drawable-xhdpi/ic_stat_timetable.png and /dev/null differ
diff --git a/app/src/debug/res/drawable-xxhdpi/ic_stat_timetable.png b/app/src/debug/res/drawable-xxhdpi/ic_stat_timetable.png
deleted file mode 100644
index 232108e8..00000000
Binary files a/app/src/debug/res/drawable-xxhdpi/ic_stat_timetable.png and /dev/null differ
diff --git a/app/src/fdroid/java/io/github/wulkanowy/utils/CrashLogUtils.kt b/app/src/fdroid/java/io/github/wulkanowy/utils/CrashlyticsUtils.kt
similarity index 71%
rename from app/src/fdroid/java/io/github/wulkanowy/utils/CrashLogUtils.kt
rename to app/src/fdroid/java/io/github/wulkanowy/utils/CrashlyticsUtils.kt
index 5d58270d..d03a319a 100644
--- a/app/src/fdroid/java/io/github/wulkanowy/utils/CrashLogUtils.kt
+++ b/app/src/fdroid/java/io/github/wulkanowy/utils/CrashlyticsUtils.kt
@@ -8,6 +8,6 @@ open class TimberTreeNoOp : Timber.Tree() {
override fun log(priority: Int, tag: String?, message: String, t: Throwable?) {}
}
-class CrashLogTree : TimberTreeNoOp()
+class CrashlyticsTree : TimberTreeNoOp()
-class CrashLogExceptionTree : TimberTreeNoOp()
+class CrashlyticsExceptionTree : TimberTreeNoOp()
diff --git a/app/src/fdroid/java/io/github/wulkanowy/utils/AnalyticsHelper.kt b/app/src/fdroid/java/io/github/wulkanowy/utils/FirebaseAnalyticsHelper.kt
similarity index 75%
rename from app/src/fdroid/java/io/github/wulkanowy/utils/AnalyticsHelper.kt
rename to app/src/fdroid/java/io/github/wulkanowy/utils/FirebaseAnalyticsHelper.kt
index 3bf7e169..f23645bc 100644
--- a/app/src/fdroid/java/io/github/wulkanowy/utils/AnalyticsHelper.kt
+++ b/app/src/fdroid/java/io/github/wulkanowy/utils/FirebaseAnalyticsHelper.kt
@@ -6,7 +6,7 @@ import javax.inject.Singleton
@Singleton
@Suppress("UNUSED_PARAMETER")
-class AnalyticsHelper @Inject constructor() {
+class FirebaseAnalyticsHelper @Inject constructor() {
fun logEvent(name: String, vararg params: Pair) {
// do nothing
@@ -15,8 +15,4 @@ class AnalyticsHelper @Inject constructor() {
fun setCurrentScreen(activity: Activity, name: String?) {
// do nothing
}
-
- fun popCurrentScreen(name: String?) {
- // do nothing
- }
}
diff --git a/app/src/hms/java/io/github/wulkanowy/utils/AnalyticsHelper.kt b/app/src/hms/java/io/github/wulkanowy/utils/AnalyticsHelper.kt
deleted file mode 100644
index 5d33825f..00000000
--- a/app/src/hms/java/io/github/wulkanowy/utils/AnalyticsHelper.kt
+++ /dev/null
@@ -1,39 +0,0 @@
-package io.github.wulkanowy.utils
-
-import android.app.Activity
-import android.content.Context
-import android.os.Bundle
-import com.huawei.hms.analytics.HiAnalytics
-import dagger.hilt.android.qualifiers.ApplicationContext
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class AnalyticsHelper @Inject constructor(
- @ApplicationContext private val context: Context
-) {
-
- private val analytics by lazy { HiAnalytics.getInstance(context) }
-
- fun logEvent(name: String, vararg params: Pair) {
- Bundle().apply {
- params.forEach {
- if (it.second == null) return@forEach
- when (it.second) {
- is String, is String? -> putString(it.first, it.second as String)
- is Int, is Int? -> putInt(it.first, it.second as Int)
- is Boolean, is Boolean? -> putBoolean(it.first, it.second as Boolean)
- }
- }
- analytics.onEvent(name, this)
- }
- }
-
- fun setCurrentScreen(activity: Activity, name: String?) {
- analytics.pageStart(name, activity::class.simpleName)
- }
-
- fun popCurrentScreen(name: String?) {
- analytics.pageEnd(name)
- }
-}
diff --git a/app/src/hms/java/io/github/wulkanowy/utils/CrashLogUtils.kt b/app/src/hms/java/io/github/wulkanowy/utils/CrashLogUtils.kt
deleted file mode 100644
index b5fb6ad7..00000000
--- a/app/src/hms/java/io/github/wulkanowy/utils/CrashLogUtils.kt
+++ /dev/null
@@ -1,53 +0,0 @@
-package io.github.wulkanowy.utils
-
-import android.util.Log
-import com.huawei.agconnect.crash.AGConnectCrash
-import fr.bipi.tressence.base.FormatterPriorityTree
-import io.github.wulkanowy.sdk.exception.FeatureNotAvailableException
-import io.github.wulkanowy.sdk.scrapper.exception.FeatureDisabledException
-import java.io.InterruptedIOException
-import java.net.SocketTimeoutException
-import java.net.UnknownHostException
-
-class CrashLogTree : FormatterPriorityTree(Log.VERBOSE) {
-
- private val connectCrash by lazy { AGConnectCrash.getInstance() }
-
- override fun log(priority: Int, tag: String?, message: String, t: Throwable?) {
- if (skipLog(priority, tag, message, t)) return
-
- connectCrash.log(format(priority, tag, message))
- }
-}
-
-class CrashLogExceptionTree : FormatterPriorityTree(Log.ERROR) {
-
- private val connectCrash by lazy { AGConnectCrash.getInstance() }
-
- override fun skipLog(priority: Int, tag: String?, message: String, t: Throwable?): Boolean {
- return when (t) {
- is FeatureDisabledException,
- is FeatureNotAvailableException,
- is UnknownHostException,
- is SocketTimeoutException,
- is InterruptedIOException -> true
- else -> super.skipLog(priority, tag, message, t)
- }
- }
-
- override fun log(priority: Int, tag: String?, message: String, t: Throwable?) {
- if (skipLog(priority, tag, message, t)) return
-
- // Disabled due to a bug in the Huawei library
-
- /*connectCrash.setCustomKey("priority", priority)
- connectCrash.setCustomKey("tag", tag.orEmpty())
- connectCrash.setCustomKey("message", message)
-
- if (t != null) {
- connectCrash.recordException(t)
- } else {
- connectCrash.recordException(StackTraceRecorder(format(priority, tag, message)))
- }*/
- }
-}
diff --git a/app/src/hms/java/io/github/wulkanowy/utils/UpdateHelper.kt b/app/src/hms/java/io/github/wulkanowy/utils/UpdateHelper.kt
deleted file mode 100644
index 3abab962..00000000
--- a/app/src/hms/java/io/github/wulkanowy/utils/UpdateHelper.kt
+++ /dev/null
@@ -1,17 +0,0 @@
-package io.github.wulkanowy.utils
-
-import android.app.Activity
-import android.view.View
-import javax.inject.Inject
-
-@Suppress("UNUSED_PARAMETER")
-class UpdateHelper @Inject constructor() {
-
- lateinit var messageContainer: View
-
- fun checkAndInstallUpdates(activity: Activity) {}
-
- fun onActivityResult(requestCode: Int, resultCode: Int) {}
-
- fun onResume(activity: Activity) {}
-}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index ac8d3be4..4ec2f781 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -9,29 +9,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{
return arrayOf(
@@ -160,12 +142,6 @@ abstract class AppDatabase : RoomDatabase() {
Migration25(),
Migration26(),
Migration27(),
- Migration28(),
- Migration29(),
- Migration30(),
- Migration31(),
- Migration32(),
- Migration33()
)
}
@@ -195,11 +171,9 @@ abstract class AppDatabase : RoomDatabase() {
abstract val gradeSummaryDao: GradeSummaryDao
- abstract val gradePartialStatisticsDao: GradePartialStatisticsDao
+ abstract val gradeStatistics: GradeStatisticsDao
- abstract val gradePointsStatisticsDao: GradePointsStatisticsDao
-
- abstract val gradeSemesterStatisticsDao: GradeSemesterStatisticsDao
+ abstract val gradePointsStatistics: GradePointsStatisticsDao
abstract val messagesDao: MessagesDao
@@ -224,10 +198,4 @@ abstract class AppDatabase : RoomDatabase() {
abstract val teacherDao: TeacherDao
abstract val schoolDao: SchoolDao
-
- abstract val conferenceDao: ConferenceDao
-
- abstract val timetableAdditionalDao: TimetableAdditionalDao
-
- abstract val studentInfoDao: StudentInfoDao
}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/SharedPrefProvider.kt b/app/src/main/java/io/github/wulkanowy/data/db/SharedPrefProvider.kt
index 9301d5fa..4a4aaf74 100644
--- a/app/src/main/java/io/github/wulkanowy/data/db/SharedPrefProvider.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/db/SharedPrefProvider.kt
@@ -6,9 +6,7 @@ import javax.inject.Inject
import javax.inject.Singleton
@Singleton
-class SharedPrefProvider @Inject constructor(
- private val sharedPref: SharedPreferences
-) {
+class SharedPrefProvider @Inject constructor(private val sharedPref: SharedPreferences) {
companion object {
const val APP_VERSION_CODE_KEY = "app_version_code"
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/dao/CompletedLessonsDao.kt b/app/src/main/java/io/github/wulkanowy/data/db/dao/CompletedLessonsDao.kt
index 097ad7c8..8c03609d 100644
--- a/app/src/main/java/io/github/wulkanowy/data/db/dao/CompletedLessonsDao.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/db/dao/CompletedLessonsDao.kt
@@ -12,5 +12,5 @@ import javax.inject.Singleton
interface CompletedLessonsDao : BaseDao {
@Query("SELECT * FROM CompletedLesson WHERE diary_id = :diaryId AND student_id = :studentId AND date >= :from AND date <= :end")
- fun loadAll(studentId: Int, diaryId: Int, from: LocalDate, end: LocalDate): Flow>
+ fun loadAll(diaryId: Int, studentId: Int, from: LocalDate, end: LocalDate): Flow>
}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/dao/ConferenceDao.kt b/app/src/main/java/io/github/wulkanowy/data/db/dao/ConferenceDao.kt
deleted file mode 100644
index 4ed9aecf..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/dao/ConferenceDao.kt
+++ /dev/null
@@ -1,15 +0,0 @@
-package io.github.wulkanowy.data.db.dao
-
-import androidx.room.Dao
-import androidx.room.Query
-import io.github.wulkanowy.data.db.entities.Conference
-import kotlinx.coroutines.flow.Flow
-import javax.inject.Singleton
-
-@Dao
-@Singleton
-interface ConferenceDao : BaseDao {
-
- @Query("SELECT * FROM Conferences WHERE diary_id = :diaryId AND student_id = :studentId")
- fun loadAll(diaryId: Int, studentId: Int): Flow>
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/dao/GradePartialStatisticsDao.kt b/app/src/main/java/io/github/wulkanowy/data/db/dao/GradePartialStatisticsDao.kt
deleted file mode 100644
index bce6ce57..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/dao/GradePartialStatisticsDao.kt
+++ /dev/null
@@ -1,13 +0,0 @@
-package io.github.wulkanowy.data.db.dao
-
-import androidx.room.Dao
-import androidx.room.Query
-import io.github.wulkanowy.data.db.entities.GradePartialStatistics
-import kotlinx.coroutines.flow.Flow
-
-@Dao
-interface GradePartialStatisticsDao : BaseDao {
-
- @Query("SELECT * FROM GradePartialStatistics WHERE student_id = :studentId AND semester_id = :semesterId")
- fun loadAll(semesterId: Int, studentId: Int): Flow>
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/dao/GradeSemesterStatisticsDao.kt b/app/src/main/java/io/github/wulkanowy/data/db/dao/GradeSemesterStatisticsDao.kt
deleted file mode 100644
index 09ae8171..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/dao/GradeSemesterStatisticsDao.kt
+++ /dev/null
@@ -1,13 +0,0 @@
-package io.github.wulkanowy.data.db.dao
-
-import androidx.room.Dao
-import androidx.room.Query
-import io.github.wulkanowy.data.db.entities.GradeSemesterStatistics
-import kotlinx.coroutines.flow.Flow
-
-@Dao
-interface GradeSemesterStatisticsDao : BaseDao {
-
- @Query("SELECT * FROM GradeSemesterStatistics WHERE student_id = :studentId AND semester_id = :semesterId")
- fun loadAll(semesterId: Int, studentId: Int): Flow>
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/dao/GradeStatisticsDao.kt b/app/src/main/java/io/github/wulkanowy/data/db/dao/GradeStatisticsDao.kt
new file mode 100644
index 00000000..b462ad5d
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/db/dao/GradeStatisticsDao.kt
@@ -0,0 +1,18 @@
+package io.github.wulkanowy.data.db.dao
+
+import androidx.room.Dao
+import androidx.room.Query
+import io.github.wulkanowy.data.db.entities.GradeStatistics
+import kotlinx.coroutines.flow.Flow
+import javax.inject.Singleton
+
+@Singleton
+@Dao
+interface GradeStatisticsDao : BaseDao {
+
+ @Query("SELECT * FROM GradesStatistics WHERE student_id = :studentId AND semester_id = :semesterId AND subject = :subjectName AND is_semester = :isSemester")
+ fun loadSubject(semesterId: Int, studentId: Int, subjectName: String, isSemester: Boolean): Flow>
+
+ @Query("SELECT * FROM GradesStatistics WHERE student_id = :studentId AND semester_id = :semesterId AND is_semester = :isSemester")
+ fun loadAll(semesterId: Int, studentId: Int, isSemester: Boolean): Flow>
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/dao/MobileDeviceDao.kt b/app/src/main/java/io/github/wulkanowy/data/db/dao/MobileDeviceDao.kt
index 081e859a..8baba2c3 100644
--- a/app/src/main/java/io/github/wulkanowy/data/db/dao/MobileDeviceDao.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/db/dao/MobileDeviceDao.kt
@@ -8,6 +8,6 @@ import kotlinx.coroutines.flow.Flow
@Dao
interface MobileDeviceDao : BaseDao {
- @Query("SELECT * FROM MobileDevices WHERE student_id = :userLoginId ORDER BY date DESC")
- fun loadAll(userLoginId: Int): Flow>
+ @Query("SELECT * FROM MobileDevices WHERE student_id = :studentId ORDER BY date DESC")
+ fun loadAll(studentId: Int): Flow>
}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/dao/RecipientDao.kt b/app/src/main/java/io/github/wulkanowy/data/db/dao/RecipientDao.kt
index 943f3f0c..419efde0 100644
--- a/app/src/main/java/io/github/wulkanowy/data/db/dao/RecipientDao.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/db/dao/RecipientDao.kt
@@ -9,6 +9,6 @@ import javax.inject.Singleton
@Dao
interface RecipientDao : BaseDao {
- @Query("SELECT * FROM Recipients WHERE student_id = :userLoginId AND unit_id = :unitId AND role = :role")
- suspend fun loadAll(userLoginId: Int, unitId: Int, role: Int): List
+ @Query("SELECT * FROM Recipients WHERE student_id = :studentId AND role = :role AND unit_id = :unitId")
+ suspend fun load(studentId: Int, role: Int, unitId: Int): List
}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/dao/StudentDao.kt b/app/src/main/java/io/github/wulkanowy/data/db/dao/StudentDao.kt
index e9c5f157..d7237ea8 100644
--- a/app/src/main/java/io/github/wulkanowy/data/db/dao/StudentDao.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/db/dao/StudentDao.kt
@@ -6,9 +6,7 @@ import androidx.room.Insert
import androidx.room.OnConflictStrategy.ABORT
import androidx.room.Query
import androidx.room.Transaction
-import androidx.room.Update
import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.data.db.entities.StudentNick
import io.github.wulkanowy.data.db.entities.StudentWithSemesters
import javax.inject.Singleton
@@ -22,9 +20,6 @@ interface StudentDao {
@Delete
suspend fun delete(student: Student)
- @Update(entity = Student::class)
- suspend fun update(studentNick: StudentNick)
-
@Query("SELECT * FROM Students WHERE is_current = 1")
suspend fun loadCurrent(): Student?
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/dao/StudentInfoDao.kt b/app/src/main/java/io/github/wulkanowy/data/db/dao/StudentInfoDao.kt
deleted file mode 100644
index 5ec86af1..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/dao/StudentInfoDao.kt
+++ /dev/null
@@ -1,15 +0,0 @@
-package io.github.wulkanowy.data.db.dao
-
-import androidx.room.Dao
-import androidx.room.Query
-import io.github.wulkanowy.data.db.entities.StudentInfo
-import kotlinx.coroutines.flow.Flow
-import javax.inject.Singleton
-
-@Singleton
-@Dao
-interface StudentInfoDao : BaseDao {
-
- @Query("SELECT * FROM StudentInfo WHERE student_id = :studentId")
- fun loadStudentInfo(studentId: Int): Flow
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/dao/TimetableAdditionalDao.kt b/app/src/main/java/io/github/wulkanowy/data/db/dao/TimetableAdditionalDao.kt
deleted file mode 100644
index 335e003e..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/dao/TimetableAdditionalDao.kt
+++ /dev/null
@@ -1,16 +0,0 @@
-package io.github.wulkanowy.data.db.dao
-
-import androidx.room.Dao
-import androidx.room.Query
-import io.github.wulkanowy.data.db.entities.TimetableAdditional
-import kotlinx.coroutines.flow.Flow
-import java.time.LocalDate
-import javax.inject.Singleton
-
-@Dao
-@Singleton
-interface TimetableAdditionalDao : BaseDao {
-
- @Query("SELECT * FROM TimetableAdditional WHERE diary_id = :diaryId AND student_id = :studentId AND date >= :from AND date <= :end")
- fun loadAll(diaryId: Int, studentId: Int, from: LocalDate, end: LocalDate): Flow>
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/entities/Conference.kt b/app/src/main/java/io/github/wulkanowy/data/db/entities/Conference.kt
deleted file mode 100644
index 8ddcbbb0..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/entities/Conference.kt
+++ /dev/null
@@ -1,35 +0,0 @@
-package io.github.wulkanowy.data.db.entities
-
-import androidx.room.ColumnInfo
-import androidx.room.Entity
-import androidx.room.PrimaryKey
-import java.io.Serializable
-import java.time.LocalDateTime
-
-@Entity(tableName = "Conferences")
-data class Conference(
-
- @ColumnInfo(name = "student_id")
- val studentId: Int,
-
- @ColumnInfo(name = "diary_id")
- val diaryId: Int,
-
- val title: String,
-
- val subject: String,
-
- val agenda: String,
-
- @ColumnInfo(name = "present_on_conference")
- val presentOnConference: String,
-
- @ColumnInfo(name = "conference_id")
- val conferenceId: Int,
-
- val date: LocalDateTime
-) : Serializable {
-
- @PrimaryKey(autoGenerate = true)
- var id: Long = 0
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/entities/GradePartialStatistics.kt b/app/src/main/java/io/github/wulkanowy/data/db/entities/GradePartialStatistics.kt
deleted file mode 100644
index db164afd..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/entities/GradePartialStatistics.kt
+++ /dev/null
@@ -1,33 +0,0 @@
-package io.github.wulkanowy.data.db.entities
-
-import androidx.room.ColumnInfo
-import androidx.room.Entity
-import androidx.room.PrimaryKey
-
-@Entity(tableName = "GradePartialStatistics")
-data class GradePartialStatistics(
-
- @ColumnInfo(name = "student_id")
- val studentId: Int,
-
- @ColumnInfo(name = "semester_id")
- val semesterId: Int,
-
- val subject: String,
-
- @ColumnInfo(name = "class_average")
- val classAverage: String,
-
- @ColumnInfo(name = "student_average")
- val studentAverage: String,
-
- @ColumnInfo(name = "class_amounts")
- val classAmounts: List,
-
- @ColumnInfo(name = "student_amounts")
- val studentAmounts: List
-
-) {
- @PrimaryKey(autoGenerate = true)
- var id: Long = 0
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/entities/GradeSemesterStatistics.kt b/app/src/main/java/io/github/wulkanowy/data/db/entities/GradeStatistics.kt
similarity index 61%
rename from app/src/main/java/io/github/wulkanowy/data/db/entities/GradeSemesterStatistics.kt
rename to app/src/main/java/io/github/wulkanowy/data/db/entities/GradeStatistics.kt
index e747271c..8ad8b8b8 100644
--- a/app/src/main/java/io/github/wulkanowy/data/db/entities/GradeSemesterStatistics.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/db/entities/GradeStatistics.kt
@@ -4,8 +4,8 @@ import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey
-@Entity(tableName = "GradeSemesterStatistics")
-data class GradeSemesterStatistics(
+@Entity(tableName = "GradesStatistics")
+data class GradeStatistics(
@ColumnInfo(name = "student_id")
val studentId: Int,
@@ -15,14 +15,13 @@ data class GradeSemesterStatistics(
val subject: String,
- val amounts: List,
+ val grade: Int,
- @ColumnInfo(name = "student_grade")
- val studentGrade: Int
+ val amount: Int,
+
+ @ColumnInfo(name = "is_semester")
+ val semester: Boolean
) {
@PrimaryKey(autoGenerate = true)
var id: Long = 0
-
- @Transient
- var average: String = ""
}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/entities/MobileDevice.kt b/app/src/main/java/io/github/wulkanowy/data/db/entities/MobileDevice.kt
index 83d82c0b..9d8f1162 100644
--- a/app/src/main/java/io/github/wulkanowy/data/db/entities/MobileDevice.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/db/entities/MobileDevice.kt
@@ -10,7 +10,7 @@ import java.time.LocalDateTime
data class MobileDevice(
@ColumnInfo(name = "student_id")
- val userLoginId: Int,
+ val studentId: Int,
@ColumnInfo(name = "device_id")
val deviceId: Int,
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/entities/Recipient.kt b/app/src/main/java/io/github/wulkanowy/data/db/entities/Recipient.kt
index b1f1f353..3021da72 100644
--- a/app/src/main/java/io/github/wulkanowy/data/db/entities/Recipient.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/db/entities/Recipient.kt
@@ -9,7 +9,7 @@ import java.io.Serializable
data class Recipient(
@ColumnInfo(name = "student_id")
- val userLoginId: Int,
+ val studentId: Int,
@ColumnInfo(name = "real_id")
val realId: String,
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/entities/ReportingUnit.kt b/app/src/main/java/io/github/wulkanowy/data/db/entities/ReportingUnit.kt
index 0570a2ff..601d8aac 100644
--- a/app/src/main/java/io/github/wulkanowy/data/db/entities/ReportingUnit.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/db/entities/ReportingUnit.kt
@@ -12,7 +12,7 @@ data class ReportingUnit(
val studentId: Int,
@ColumnInfo(name = "real_id")
- val unitId: Int,
+ val realId: Int,
@ColumnInfo(name = "short")
val shortName: String,
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/entities/Student.kt b/app/src/main/java/io/github/wulkanowy/data/db/entities/Student.kt
index 6b60c814..b6c75ff8 100644
--- a/app/src/main/java/io/github/wulkanowy/data/db/entities/Student.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/db/entities/Student.kt
@@ -7,13 +7,7 @@ import androidx.room.PrimaryKey
import java.io.Serializable
import java.time.LocalDateTime
-@Entity(
- tableName = "Students",
- indices = [Index(
- value = ["email", "symbol", "student_id", "school_id", "class_id"],
- unique = true
- )]
-)
+@Entity(tableName = "Students", indices = [Index(value = ["email", "symbol", "student_id", "school_id", "class_id"], unique = true)])
data class Student(
@ColumnInfo(name = "scrapper_base_url")
@@ -58,7 +52,7 @@ data class Student(
@ColumnInfo(name = "school_id")
val schoolSymbol: String,
- @ColumnInfo(name = "school_short")
+ @ColumnInfo(name ="school_short")
val schoolShortName: String,
@ColumnInfo(name = "school_name")
@@ -79,6 +73,4 @@ data class Student(
@PrimaryKey(autoGenerate = true)
var id: Long = 0
-
- var nick = ""
}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/entities/StudentInfo.kt b/app/src/main/java/io/github/wulkanowy/data/db/entities/StudentInfo.kt
deleted file mode 100644
index 7366e547..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/entities/StudentInfo.kt
+++ /dev/null
@@ -1,85 +0,0 @@
-package io.github.wulkanowy.data.db.entities
-
-import androidx.room.ColumnInfo
-import androidx.room.Embedded
-import androidx.room.Entity
-import androidx.room.PrimaryKey
-import io.github.wulkanowy.data.enums.Gender
-import java.io.Serializable
-import java.time.LocalDate
-
-@Entity(tableName = "StudentInfo")
-data class StudentInfo(
-
- @ColumnInfo(name = "student_id")
- val studentId: Int,
-
- @ColumnInfo(name = "full_name")
- val fullName: String,
-
- @ColumnInfo(name = "first_name")
- val firstName: String,
-
- @ColumnInfo(name = "second_name")
- val secondName: String,
-
- val surname: String,
-
- @ColumnInfo(name = "birth_date")
- val birthDate: LocalDate,
-
- @ColumnInfo(name = "birth_place")
- val birthPlace: String,
-
- val gender: Gender,
-
- @ColumnInfo(name = "has_polish_citizenship")
- val hasPolishCitizenship: Boolean,
-
- @ColumnInfo(name = "family_name")
- val familyName: String,
-
- @ColumnInfo(name = "parents_names")
- val parentsNames: String,
-
- val address: String,
-
- @ColumnInfo(name = "registered_address")
- val registeredAddress: String,
-
- @ColumnInfo(name = "correspondence_address")
- val correspondenceAddress: String,
-
- @ColumnInfo(name = "phone_number")
- val phoneNumber: String,
-
- @ColumnInfo(name = "cell_phone_number")
- val cellPhoneNumber: String,
-
- val email: String,
-
- @Embedded(prefix = "first_guardian_")
- val firstGuardian: StudentGuardian?,
-
- @Embedded(prefix = "second_guardian_")
- val secondGuardian: StudentGuardian?
-
-) : Serializable {
-
- @PrimaryKey(autoGenerate = true)
- var id: Long = 0
-}
-
-data class StudentGuardian(
-
- @ColumnInfo(name = "full_name")
- val fullName: String,
-
- val kinship: String,
-
- val address: String,
-
- val phones: String,
-
- val email: String
-) : Serializable
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/entities/StudentNick.kt b/app/src/main/java/io/github/wulkanowy/data/db/entities/StudentNick.kt
deleted file mode 100644
index 71f48f7a..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/entities/StudentNick.kt
+++ /dev/null
@@ -1,16 +0,0 @@
-package io.github.wulkanowy.data.db.entities
-
-import androidx.room.Entity
-import androidx.room.PrimaryKey
-import java.io.Serializable
-
-@Entity
-data class StudentNick(
-
- val nick: String
-
-) : Serializable {
-
- @PrimaryKey
- var id: Long = 0
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/entities/TimetableAdditional.kt b/app/src/main/java/io/github/wulkanowy/data/db/entities/TimetableAdditional.kt
deleted file mode 100644
index c1f1365f..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/entities/TimetableAdditional.kt
+++ /dev/null
@@ -1,30 +0,0 @@
-package io.github.wulkanowy.data.db.entities
-
-import androidx.room.ColumnInfo
-import androidx.room.Entity
-import androidx.room.PrimaryKey
-import java.io.Serializable
-import java.time.LocalDate
-import java.time.LocalDateTime
-
-@Entity(tableName = "TimetableAdditional")
-data class TimetableAdditional(
-
- @ColumnInfo(name = "student_id")
- val studentId: Int,
-
- @ColumnInfo(name = "diary_id")
- val diaryId: Int,
-
- val start: LocalDateTime,
-
- val end: LocalDateTime,
-
- val date: LocalDate,
-
- val subject: String,
-) : Serializable {
-
- @PrimaryKey(autoGenerate = true)
- var id: Long = 0
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration28.kt b/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration28.kt
deleted file mode 100644
index 51e7628b..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration28.kt
+++ /dev/null
@@ -1,23 +0,0 @@
-package io.github.wulkanowy.data.db.migrations
-
-import androidx.room.migration.Migration
-import androidx.sqlite.db.SupportSQLiteDatabase
-
-class Migration28 : Migration(27, 28) {
-
- override fun migrate(database: SupportSQLiteDatabase) {
- database.execSQL("""
- CREATE TABLE IF NOT EXISTS Conferences (
- id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
- student_id INTEGER NOT NULL,
- diary_id INTEGER NOT NULL,
- title TEXT NOT NULL,
- subject TEXT NOT NULL,
- agenda TEXT NOT NULL,
- present_on_conference TEXT NOT NULL,
- conference_id INTEGER NOT NULL,
- date INTEGER NOT NULL
- )
- """)
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration29.kt b/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration29.kt
deleted file mode 100644
index 327552d7..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration29.kt
+++ /dev/null
@@ -1,33 +0,0 @@
-package io.github.wulkanowy.data.db.migrations
-
-import androidx.room.migration.Migration
-import androidx.sqlite.db.SupportSQLiteDatabase
-
-class Migration29 : Migration(28, 29) {
-
- override fun migrate(database: SupportSQLiteDatabase) {
- database.execSQL("DROP TABLE IF EXISTS GradesStatistics")
- database.execSQL("""
- CREATE TABLE IF NOT EXISTS GradeSemesterStatistics (
- id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
- student_id INTEGER NOT NULL,
- semester_id INTEGER NOT NULL,
- subject TEXT NOT NULL,
- amounts TEXT NOT NULL,
- student_grade INTEGER NOT NULL
- )
- """)
- database.execSQL("""
- CREATE TABLE IF NOT EXISTS GradePartialStatistics (
- id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
- student_id INTEGER NOT NULL,
- semester_id INTEGER NOT NULL,
- subject TEXT NOT NULL,
- class_average TEXT NOT NULL,
- student_average TEXT NOT NULL,
- class_amounts TEXT NOT NULL,
- student_amounts TEXT NOT NULL
- )
- """)
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration30.kt b/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration30.kt
deleted file mode 100644
index b33914fe..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration30.kt
+++ /dev/null
@@ -1,21 +0,0 @@
-package io.github.wulkanowy.data.db.migrations
-
-import androidx.room.migration.Migration
-import androidx.sqlite.db.SupportSQLiteDatabase
-
-class Migration30 : Migration(29, 30) {
-
- override fun migrate(database: SupportSQLiteDatabase) {
- database.execSQL("""
- CREATE TABLE TimetableAdditional (
- id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
- student_id INTEGER NOT NULL,
- diary_id INTEGER NOT NULL,
- start INTEGER NOT NULL,
- `end` INTEGER NOT NULL,
- date INTEGER NOT NULL,
- subject TEXT NOT NULL
- )
- """)
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration31.kt b/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration31.kt
deleted file mode 100644
index 064a3e5b..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration31.kt
+++ /dev/null
@@ -1,42 +0,0 @@
-package io.github.wulkanowy.data.db.migrations
-
-import androidx.room.migration.Migration
-import androidx.sqlite.db.SupportSQLiteDatabase
-
-class Migration31 : Migration(30, 31) {
-
- override fun migrate(database: SupportSQLiteDatabase) {
- database.execSQL(
- """CREATE TABLE IF NOT EXISTS StudentInfo (
- id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
- student_id INTEGER NOT NULL,
- full_name TEXT NOT NULL,
- first_name TEXT NOT NULL,
- second_name TEXT NOT NULL,
- surname TEXT NOT NULL,
- birth_date INTEGER NOT NULL,
- birth_place TEXT NOT NULL,
- gender TEXT NOT NULL,
- has_polish_citizenship INTEGER NOT NULL,
- family_name TEXT NOT NULL,
- parents_names TEXT NOT NULL,
- address TEXT NOT NULL,
- registered_address TEXT NOT NULL,
- correspondence_address TEXT NOT NULL,
- phone_number TEXT NOT NULL,
- cell_phone_number TEXT NOT NULL,
- email TEXT NOT NULL,
- first_guardian_full_name TEXT NOT NULL,
- first_guardian_kinship TEXT NOT NULL,
- first_guardian_address TEXT NOT NULL,
- first_guardian_phones TEXT NOT NULL,
- first_guardian_email TEXT NOT NULL,
- second_guardian_full_name TEXT NOT NULL,
- second_guardian_kinship TEXT NOT NULL,
- second_guardian_address TEXT NOT NULL,
- second_guardian_phones TEXT NOT NULL,
- second_guardian_email TEXT NOT NULL)
- """
- )
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration32.kt b/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration32.kt
deleted file mode 100644
index 508485e0..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration32.kt
+++ /dev/null
@@ -1,12 +0,0 @@
-package io.github.wulkanowy.data.db.migrations
-
-import androidx.room.migration.Migration
-import androidx.sqlite.db.SupportSQLiteDatabase
-
-class Migration32 : Migration(31, 32) {
-
- override fun migrate(database: SupportSQLiteDatabase) {
- database.execSQL("ALTER TABLE Students ADD COLUMN nick TEXT NOT NULL DEFAULT \"\"")
- }
-}
-
diff --git a/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration33.kt b/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration33.kt
deleted file mode 100644
index 4a57880d..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/db/migrations/Migration33.kt
+++ /dev/null
@@ -1,45 +0,0 @@
-package io.github.wulkanowy.data.db.migrations
-
-import androidx.room.migration.Migration
-import androidx.sqlite.db.SupportSQLiteDatabase
-
-class Migration33 : Migration(32, 33) {
-
- override fun migrate(database: SupportSQLiteDatabase) {
- database.execSQL("DROP TABLE IF EXISTS StudentInfo")
-
- database.execSQL(
- """CREATE TABLE IF NOT EXISTS StudentInfo (
- id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
- student_id INTEGER NOT NULL,
- full_name TEXT NOT NULL,
- first_name TEXT NOT NULL,
- second_name TEXT NOT NULL,
- surname TEXT NOT NULL,
- birth_date INTEGER NOT NULL,
- birth_place TEXT NOT NULL,
- gender TEXT NOT NULL,
- has_polish_citizenship INTEGER NOT NULL,
- family_name TEXT NOT NULL,
- parents_names TEXT NOT NULL,
- address TEXT NOT NULL,
- registered_address TEXT NOT NULL,
- correspondence_address TEXT NOT NULL,
- phone_number TEXT NOT NULL,
- cell_phone_number TEXT NOT NULL,
- email TEXT NOT NULL,
- first_guardian_full_name TEXT,
- first_guardian_kinship TEXT,
- first_guardian_address TEXT,
- first_guardian_phones TEXT,
- first_guardian_email TEXT,
- second_guardian_full_name TEXT,
- second_guardian_kinship TEXT,
- second_guardian_address TEXT,
- second_guardian_phones TEXT,
- second_guardian_email TEXT)
- """
- )
- }
-}
-
diff --git a/app/src/main/java/io/github/wulkanowy/data/enums/Gender.kt b/app/src/main/java/io/github/wulkanowy/data/enums/Gender.kt
deleted file mode 100644
index df93dcbe..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/enums/Gender.kt
+++ /dev/null
@@ -1,3 +0,0 @@
-package io.github.wulkanowy.data.enums
-
-enum class Gender { MALE, FEMALE }
diff --git a/app/src/main/java/io/github/wulkanowy/data/mappers/AttendanceMapper.kt b/app/src/main/java/io/github/wulkanowy/data/mappers/AttendanceMapper.kt
deleted file mode 100644
index 46e67fda..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/mappers/AttendanceMapper.kt
+++ /dev/null
@@ -1,43 +0,0 @@
-package io.github.wulkanowy.data.mappers
-
-import io.github.wulkanowy.data.db.entities.Attendance
-import io.github.wulkanowy.data.db.entities.AttendanceSummary
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.sdk.pojo.Attendance as SdkAttendance
-import io.github.wulkanowy.sdk.pojo.AttendanceSummary as SdkAttendanceSummary
-
-fun List.mapToEntities(semester: Semester) = map {
- Attendance(
- studentId = semester.studentId,
- diaryId = semester.diaryId,
- date = it.date,
- timeId = it.timeId,
- number = it.number,
- subject = it.subject,
- name = it.name,
- presence = it.presence,
- absence = it.absence,
- exemption = it.exemption,
- lateness = it.lateness,
- excused = it.excused,
- deleted = it.deleted,
- excusable = it.excusable,
- excuseStatus = it.excuseStatus?.name
- )
-}
-
-fun List.mapToEntities(semester: Semester, subjectId: Int) = map {
- AttendanceSummary(
- studentId = semester.studentId,
- diaryId = semester.diaryId,
- subjectId = subjectId,
- month = it.month,
- presence = it.presence,
- absence = it.absence,
- absenceExcused = it.absenceExcused,
- absenceForSchoolReasons = it.absenceForSchoolReasons,
- lateness = it.lateness,
- latenessExcused = it.latenessExcused,
- exemption = it.exemption
- )
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/mappers/CompletedLessonsMapper.kt b/app/src/main/java/io/github/wulkanowy/data/mappers/CompletedLessonsMapper.kt
deleted file mode 100644
index c42126eb..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/mappers/CompletedLessonsMapper.kt
+++ /dev/null
@@ -1,21 +0,0 @@
-package io.github.wulkanowy.data.mappers
-
-import io.github.wulkanowy.data.db.entities.CompletedLesson
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.sdk.pojo.CompletedLesson as SdkCompletedLesson
-
-fun List.mapToEntities(semester: Semester) = map {
- CompletedLesson(
- studentId = semester.studentId,
- diaryId = semester.diaryId,
- date = it.date,
- number = it.number,
- subject = it.subject,
- topic = it.topic,
- teacher = it.teacher,
- teacherSymbol = it.teacherSymbol,
- substitution = it.substitution,
- absence = it.absence,
- resources = it.resources
- )
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/mappers/ConferenceMapper.kt b/app/src/main/java/io/github/wulkanowy/data/mappers/ConferenceMapper.kt
deleted file mode 100644
index 52dc9b30..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/mappers/ConferenceMapper.kt
+++ /dev/null
@@ -1,18 +0,0 @@
-package io.github.wulkanowy.data.mappers
-
-import io.github.wulkanowy.data.db.entities.Conference
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.sdk.pojo.Conference as SdkConference
-
-fun List.mapToEntities(semester: Semester) = map {
- Conference(
- studentId = semester.studentId,
- diaryId = semester.diaryId,
- agenda = it.agenda,
- conferenceId = it.id,
- date = it.date,
- presentOnConference = it.presentOnConference,
- subject = it.subject,
- title = it.title
- )
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/mappers/ExamMapper.kt b/app/src/main/java/io/github/wulkanowy/data/mappers/ExamMapper.kt
deleted file mode 100644
index bdb5efbb..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/mappers/ExamMapper.kt
+++ /dev/null
@@ -1,20 +0,0 @@
-package io.github.wulkanowy.data.mappers
-
-import io.github.wulkanowy.data.db.entities.Exam
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.sdk.pojo.Exam as SdkExam
-
-fun List.mapToEntities(semester: Semester) = map {
- Exam(
- studentId = semester.studentId,
- diaryId = semester.diaryId,
- date = it.date,
- entryDate = it.entryDate,
- subject = it.subject,
- group = it.group,
- type = it.type,
- description = it.description,
- teacher = it.teacher,
- teacherSymbol = it.teacherSymbol
- )
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/mappers/GradeMapper.kt b/app/src/main/java/io/github/wulkanowy/data/mappers/GradeMapper.kt
deleted file mode 100644
index 178de682..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/mappers/GradeMapper.kt
+++ /dev/null
@@ -1,42 +0,0 @@
-package io.github.wulkanowy.data.mappers
-
-import io.github.wulkanowy.data.db.entities.Grade
-import io.github.wulkanowy.data.db.entities.GradeSummary
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.sdk.pojo.GradeSummary as SdkGradeSummary
-import io.github.wulkanowy.sdk.pojo.Grade as SdkGrade
-
-fun List.mapToEntities(semester: Semester) = map {
- Grade(
- studentId = semester.studentId,
- semesterId = semester.semesterId,
- subject = it.subject,
- entry = it.entry,
- value = it.value,
- modifier = it.modifier,
- comment = it.comment,
- color = it.color,
- gradeSymbol = it.symbol,
- description = it.description,
- weight = it.weight,
- weightValue = it.weightValue,
- date = it.date,
- teacher = it.teacher
- )
-}
-
-@JvmName("mapGradeSummaryToEntities")
-fun List.mapToEntities(semester: Semester) = map {
- GradeSummary(
- semesterId = semester.semesterId,
- studentId = semester.studentId,
- position = 0,
- subject = it.name,
- predictedGrade = it.predicted,
- finalGrade = it.final,
- pointsSum = it.pointsSum,
- proposedPoints = it.proposedPoints,
- finalPoints = it.finalPoints,
- average = it.average
- )
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/mappers/GradeStatisticsMapper.kt b/app/src/main/java/io/github/wulkanowy/data/mappers/GradeStatisticsMapper.kt
deleted file mode 100644
index fbd40433..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/mappers/GradeStatisticsMapper.kt
+++ /dev/null
@@ -1,80 +0,0 @@
-package io.github.wulkanowy.data.mappers
-
-import io.github.wulkanowy.data.db.entities.GradePartialStatistics
-import io.github.wulkanowy.data.db.entities.GradePointsStatistics
-import io.github.wulkanowy.data.db.entities.GradeSemesterStatistics
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.data.pojos.GradeStatisticsItem
-import io.github.wulkanowy.ui.modules.grade.statistics.ViewType
-import io.github.wulkanowy.sdk.pojo.GradeStatisticsSubject as SdkGradeStatisticsSubject
-import io.github.wulkanowy.sdk.pojo.GradeStatisticsSemester as SdkGradeStatisticsSemester
-import io.github.wulkanowy.sdk.pojo.GradePointsStatistics as SdkGradePointsStatistics
-
-@JvmName("mapToEntitiesSubject")
-fun List.mapToEntities(semester: Semester) = map {
- GradePartialStatistics(
- semesterId = semester.semesterId,
- studentId = semester.studentId,
- subject = it.subject,
- classAverage = it.classAverage,
- studentAverage = it.studentAverage,
- classAmounts = it.classItems
- .sortedBy { item -> item.grade }
- .map { item -> item.amount },
- studentAmounts = it.studentItems.map { item -> item.amount }
- )
-}
-
-@JvmName("mapToEntitiesSemester")
-fun List.mapToEntities(semester: Semester) = map {
- GradeSemesterStatistics(
- semesterId = semester.semesterId,
- studentId = semester.studentId,
- subject = it.subject,
- amounts = it.items
- .sortedBy { item -> item.grade }
- .map { item -> item.amount },
- studentGrade = it.items.singleOrNull { item -> item.isStudentHere }?.grade ?: 0
- )
-}
-
-@JvmName("mapToEntitiesPoints")
-fun List.mapToEntities(semester: Semester) = map {
- GradePointsStatistics(
- semesterId = semester.semesterId,
- studentId = semester.studentId,
- subject = it.subject,
- others = it.others,
- student = it.student
- )
-}
-
-fun List.mapPartialToStatisticItems() = filterNot { it.classAmounts.isEmpty() }.map {
- GradeStatisticsItem(
- type = ViewType.PARTIAL,
- average = it.classAverage,
- partial = it,
- points = null,
- semester = null
- )
-}
-
-fun List.mapSemesterToStatisticItems() = filterNot { it.amounts.isEmpty() }.map {
- GradeStatisticsItem(
- type = ViewType.SEMESTER,
- partial = null,
- points = null,
- average = "",
- semester = it
- )
-}
-
-fun List.mapPointsToStatisticsItems() = map {
- GradeStatisticsItem(
- type = ViewType.POINTS,
- partial = null,
- semester = null,
- average = "",
- points = it
- )
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/mappers/HomeworkMapper.kt b/app/src/main/java/io/github/wulkanowy/data/mappers/HomeworkMapper.kt
deleted file mode 100644
index 880a26d6..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/mappers/HomeworkMapper.kt
+++ /dev/null
@@ -1,21 +0,0 @@
-package io.github.wulkanowy.data.mappers
-
-import io.github.wulkanowy.sdk.pojo.Homework as SdkHomework
-import io.github.wulkanowy.data.db.entities.Homework
-import io.github.wulkanowy.data.db.entities.Semester
-
-fun List.mapToEntities(semester: Semester) = map {
- Homework(
- semesterId = semester.semesterId,
- studentId = semester.studentId,
- date = it.date,
- entryDate = it.entryDate,
- subject = it.subject,
- content = it.content,
- teacher = it.teacher,
- teacherSymbol = it.teacherSymbol,
- attachments = it.attachments.map { attachment ->
- attachment.url to attachment.name
- }
- )
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/mappers/LuckyNumberMapper.kt b/app/src/main/java/io/github/wulkanowy/data/mappers/LuckyNumberMapper.kt
deleted file mode 100644
index 78ebe1d6..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/mappers/LuckyNumberMapper.kt
+++ /dev/null
@@ -1,12 +0,0 @@
-package io.github.wulkanowy.data.mappers
-
-import io.github.wulkanowy.data.db.entities.LuckyNumber
-import io.github.wulkanowy.data.db.entities.Student
-import java.time.LocalDate
-import io.github.wulkanowy.sdk.pojo.LuckyNumber as SdkLuckyNumber
-
-fun SdkLuckyNumber.mapToEntity(student: Student) = LuckyNumber(
- studentId = student.studentId,
- date = LocalDate.now(),
- luckyNumber = number
-)
diff --git a/app/src/main/java/io/github/wulkanowy/data/mappers/MessageMapper.kt b/app/src/main/java/io/github/wulkanowy/data/mappers/MessageMapper.kt
deleted file mode 100644
index 2c815b30..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/mappers/MessageMapper.kt
+++ /dev/null
@@ -1,53 +0,0 @@
-package io.github.wulkanowy.data.mappers
-
-import io.github.wulkanowy.data.db.entities.Message
-import io.github.wulkanowy.data.db.entities.MessageAttachment
-import io.github.wulkanowy.data.db.entities.Recipient
-import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.sdk.pojo.Recipient as SdkRecipient
-import io.github.wulkanowy.sdk.pojo.MessageAttachment as SdkMessageAttachment
-import java.time.LocalDateTime
-import io.github.wulkanowy.sdk.pojo.Message as SdkMessage
-
-fun List.mapToEntities(student: Student) = map {
- Message(
- studentId = student.id.toInt(),
- realId = it.id ?: 0,
- messageId = it.messageId ?: 0,
- sender = it.sender?.name.orEmpty(),
- senderId = it.sender?.loginId ?: 0,
- recipient = it.recipients.singleOrNull()?.name ?: "Wielu adresatów",
- subject = it.subject.trim(),
- date = it.date ?: LocalDateTime.now(),
- folderId = it.folderId,
- unread = it.unread ?: false,
- removed = it.removed,
- hasAttachments = it.hasAttachments
- ).apply {
- content = it.content.orEmpty()
- unreadBy = it.unreadBy ?: 0
- readBy = it.readBy ?: 0
- }
-}
-
-fun List.mapToEntities() = map {
- MessageAttachment(
- realId = it.id,
- messageId = it.messageId,
- oneDriveId = it.oneDriveId,
- url = it.url,
- filename = it.filename
- )
-}
-
-fun List.mapFromEntities() = map {
- SdkRecipient(
- id = it.realId,
- name = it.realName,
- loginId = it.loginId,
- reportingUnitId = it.unitId,
- role = it.role,
- hash = it.hash,
- shortName = it.name
- )
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/mappers/MobileDeviceMapper.kt b/app/src/main/java/io/github/wulkanowy/data/mappers/MobileDeviceMapper.kt
deleted file mode 100644
index f0c375bf..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/mappers/MobileDeviceMapper.kt
+++ /dev/null
@@ -1,23 +0,0 @@
-package io.github.wulkanowy.data.mappers
-
-import io.github.wulkanowy.data.db.entities.MobileDevice
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.data.pojos.MobileDeviceToken
-import io.github.wulkanowy.sdk.pojo.Token as SdkToken
-import io.github.wulkanowy.sdk.pojo.Device as SdkDevice
-
-fun List.mapToEntities(semester: Semester) = map {
- MobileDevice(
- userLoginId = semester.studentId,
- date = it.createDate,
- deviceId = it.id,
- name = it.name
- )
-}
-
-fun SdkToken.mapToMobileDeviceToken() = MobileDeviceToken(
- token = token,
- symbol = symbol,
- pin = pin,
- qr = qrCodeImage
-)
diff --git a/app/src/main/java/io/github/wulkanowy/data/mappers/NoteMapper.kt b/app/src/main/java/io/github/wulkanowy/data/mappers/NoteMapper.kt
deleted file mode 100644
index 70941799..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/mappers/NoteMapper.kt
+++ /dev/null
@@ -1,19 +0,0 @@
-package io.github.wulkanowy.data.mappers
-
-import io.github.wulkanowy.data.db.entities.Note
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.sdk.pojo.Note as SdkNote
-
-fun List.mapToEntities(semester: Semester) = map {
- Note(
- studentId = semester.studentId,
- date = it.date,
- teacher = it.teacher,
- teacherSymbol = it.teacherSymbol,
- category = it.category,
- categoryType = it.categoryType.id,
- isPointsShow = it.showPoints,
- points = it.points,
- content = it.content
- )
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/mappers/RecipientMapper.kt b/app/src/main/java/io/github/wulkanowy/data/mappers/RecipientMapper.kt
deleted file mode 100644
index 9996f680..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/mappers/RecipientMapper.kt
+++ /dev/null
@@ -1,17 +0,0 @@
-package io.github.wulkanowy.data.mappers
-
-import io.github.wulkanowy.data.db.entities.Recipient
-import io.github.wulkanowy.sdk.pojo.Recipient as SdkRecipient
-
-fun List.mapToEntities(userLoginId: Int) = map {
- Recipient(
- userLoginId = userLoginId,
- realId = it.id,
- realName = it.name,
- name = it.shortName,
- hash = it.hash,
- loginId = it.loginId,
- role = it.role,
- unitId = it.reportingUnitId ?: 0
- )
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/mappers/ReportingUnitMapper.kt b/app/src/main/java/io/github/wulkanowy/data/mappers/ReportingUnitMapper.kt
deleted file mode 100644
index 71ea7099..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/mappers/ReportingUnitMapper.kt
+++ /dev/null
@@ -1,16 +0,0 @@
-package io.github.wulkanowy.data.mappers
-
-import io.github.wulkanowy.data.db.entities.ReportingUnit
-import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.sdk.pojo.ReportingUnit as SdkReportingUnit
-
-fun List.mapToEntities(student: Student) = map {
- ReportingUnit(
- studentId = student.studentId,
- unitId = it.id,
- roles = it.roles,
- senderId = it.senderId,
- senderName = it.senderName,
- shortName = it.short
- )
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/mappers/SchoolInfoMapper.kt b/app/src/main/java/io/github/wulkanowy/data/mappers/SchoolInfoMapper.kt
deleted file mode 100644
index dc3a5a9e..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/mappers/SchoolInfoMapper.kt
+++ /dev/null
@@ -1,15 +0,0 @@
-package io.github.wulkanowy.data.mappers
-
-import io.github.wulkanowy.data.db.entities.School
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.sdk.pojo.School as SdkSchool
-
-fun SdkSchool.mapToEntity(semester: Semester) = School(
- studentId = semester.studentId,
- classId = semester.classId,
- name = name,
- address = address,
- contact = contact,
- headmaster = headmaster,
- pedagogue = pedagogue
-)
diff --git a/app/src/main/java/io/github/wulkanowy/data/mappers/StudentInfoMapper.kt b/app/src/main/java/io/github/wulkanowy/data/mappers/StudentInfoMapper.kt
deleted file mode 100644
index 9e853390..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/mappers/StudentInfoMapper.kt
+++ /dev/null
@@ -1,38 +0,0 @@
-package io.github.wulkanowy.data.mappers
-
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.data.db.entities.StudentGuardian
-import io.github.wulkanowy.data.db.entities.StudentInfo
-import io.github.wulkanowy.data.enums.Gender
-import io.github.wulkanowy.sdk.pojo.StudentGuardian as SdkStudentGuardian
-import io.github.wulkanowy.sdk.pojo.StudentInfo as SdkStudentInfo
-
-fun SdkStudentInfo.mapToEntity(semester: Semester) = StudentInfo(
- studentId = semester.studentId,
- fullName = fullName,
- firstName = firstName,
- secondName = secondName,
- surname = surname,
- birthDate = birthDate,
- birthPlace = birthPlace,
- gender = Gender.valueOf(gender.name),
- hasPolishCitizenship = hasPolishCitizenship,
- familyName = familyName,
- parentsNames = parentsNames,
- address = address,
- registeredAddress = registeredAddress,
- correspondenceAddress = correspondenceAddress,
- phoneNumber = phoneNumber,
- cellPhoneNumber = phoneNumber,
- email = email,
- firstGuardian = guardianFirst?.mapToEntity(),
- secondGuardian = guardianSecond?.mapToEntity()
-)
-
-fun SdkStudentGuardian.mapToEntity() = StudentGuardian(
- fullName = fullName,
- kinship = kinship,
- address = address,
- phones = phones,
- email = email
-)
diff --git a/app/src/main/java/io/github/wulkanowy/data/mappers/SubjectMapper.kt b/app/src/main/java/io/github/wulkanowy/data/mappers/SubjectMapper.kt
deleted file mode 100644
index 4dc95aaa..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/mappers/SubjectMapper.kt
+++ /dev/null
@@ -1,14 +0,0 @@
-package io.github.wulkanowy.data.mappers
-
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.data.db.entities.Subject
-import io.github.wulkanowy.sdk.pojo.Subject as SdkSubject
-
-fun List.mapToEntities(semester: Semester) = map {
- Subject(
- studentId = semester.studentId,
- diaryId = semester.diaryId,
- name = it.name,
- realId = it.id
- )
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/mappers/TeacherMapper.kt b/app/src/main/java/io/github/wulkanowy/data/mappers/TeacherMapper.kt
deleted file mode 100644
index 49cb7c29..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/mappers/TeacherMapper.kt
+++ /dev/null
@@ -1,15 +0,0 @@
-package io.github.wulkanowy.data.mappers
-
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.data.db.entities.Teacher
-import io.github.wulkanowy.sdk.pojo.Teacher as SdkTeacher
-
-fun List.mapToEntities(semester: Semester) = map {
- Teacher(
- studentId = semester.studentId,
- name = it.name,
- subject = it.subject,
- shortName = it.short,
- classId = semester.classId
- )
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/mappers/TimetableMapper.kt b/app/src/main/java/io/github/wulkanowy/data/mappers/TimetableMapper.kt
deleted file mode 100644
index ffd2ae34..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/mappers/TimetableMapper.kt
+++ /dev/null
@@ -1,41 +0,0 @@
-package io.github.wulkanowy.data.mappers
-
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.data.db.entities.Timetable
-import io.github.wulkanowy.data.db.entities.TimetableAdditional
-import io.github.wulkanowy.sdk.pojo.Timetable as SdkTimetable
-import io.github.wulkanowy.sdk.pojo.TimetableAdditional as SdkTimetableAdditional
-
-fun List.mapToEntities(semester: Semester) = map {
- Timetable(
- studentId = semester.studentId,
- diaryId = semester.diaryId,
- number = it.number,
- start = it.start,
- end = it.end,
- date = it.date,
- subject = it.subject,
- subjectOld = it.subjectOld,
- group = it.group,
- room = it.room,
- roomOld = it.roomOld,
- teacher = it.teacher,
- teacherOld = it.teacherOld,
- info = it.info,
- isStudentPlan = it.studentPlan,
- changes = it.changes,
- canceled = it.canceled
- )
-}
-
-@JvmName("mapToEntitiesTimetableAdditional")
-fun List.mapToEntities(semester: Semester) = map {
- TimetableAdditional(
- studentId = semester.studentId,
- diaryId = semester.diaryId,
- subject = it.subject,
- date = it.date,
- start = it.start,
- end = it.end
- )
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/pojos/GradeStatisticsItem.kt b/app/src/main/java/io/github/wulkanowy/data/pojos/GradeStatisticsItem.kt
index 88257470..34b62abd 100644
--- a/app/src/main/java/io/github/wulkanowy/data/pojos/GradeStatisticsItem.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/pojos/GradeStatisticsItem.kt
@@ -1,19 +1,14 @@
package io.github.wulkanowy.data.pojos
-import io.github.wulkanowy.data.db.entities.GradePartialStatistics
import io.github.wulkanowy.data.db.entities.GradePointsStatistics
-import io.github.wulkanowy.data.db.entities.GradeSemesterStatistics
+import io.github.wulkanowy.data.db.entities.GradeStatistics
import io.github.wulkanowy.ui.modules.grade.statistics.ViewType
data class GradeStatisticsItem(
val type: ViewType,
- val average: String,
-
- val partial: GradePartialStatistics?,
-
- val semester: GradeSemesterStatistics?,
+ val partial: List,
val points: GradePointsStatistics?
)
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/AttendanceRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/AttendanceRepository.kt
deleted file mode 100644
index 9a6528f3..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/AttendanceRepository.kt
+++ /dev/null
@@ -1,57 +0,0 @@
-package io.github.wulkanowy.data.repositories
-
-import io.github.wulkanowy.data.db.dao.AttendanceDao
-import io.github.wulkanowy.data.db.entities.Attendance
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.data.mappers.mapToEntities
-import io.github.wulkanowy.sdk.Sdk
-import io.github.wulkanowy.sdk.pojo.Absent
-import io.github.wulkanowy.utils.AutoRefreshHelper
-import io.github.wulkanowy.utils.getRefreshKey
-import io.github.wulkanowy.utils.init
-import io.github.wulkanowy.utils.monday
-import io.github.wulkanowy.utils.networkBoundResource
-import io.github.wulkanowy.utils.sunday
-import io.github.wulkanowy.utils.uniqueSubtract
-import java.time.LocalDate
-import java.time.LocalDateTime
-import java.time.LocalTime
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class AttendanceRepository @Inject constructor(
- private val attendanceDb: AttendanceDao,
- private val sdk: Sdk,
- private val refreshHelper: AutoRefreshHelper,
-) {
-
- private val cacheKey = "attendance"
-
- fun getAttendance(student: Student, semester: Semester, start: LocalDate, end: LocalDate, forceRefresh: Boolean) = networkBoundResource(
- shouldFetch = { it.isEmpty() || forceRefresh || refreshHelper.isShouldBeRefreshed(getRefreshKey(cacheKey, semester, start, end)) },
- query = { attendanceDb.loadAll(semester.diaryId, semester.studentId, start.monday, end.sunday) },
- fetch = {
- sdk.init(student).switchDiary(semester.diaryId, semester.schoolYear)
- .getAttendance(start.monday, end.sunday, semester.semesterId)
- .mapToEntities(semester)
- },
- saveFetchResult = { old, new ->
- attendanceDb.deleteAll(old uniqueSubtract new)
- attendanceDb.insertAll(new uniqueSubtract old)
-
- refreshHelper.updateLastRefreshTimestamp(getRefreshKey(cacheKey, semester, start, end))
- },
- filterResult = { it.filter { item -> item.date in start..end } }
- )
-
- suspend fun excuseForAbsence(student: Student, semester: Semester, absenceList: List, reason: String? = null) {
- sdk.init(student).switchDiary(semester.diaryId, semester.schoolYear).excuseForAbsence(absenceList.map { attendance ->
- Absent(
- date = LocalDateTime.of(attendance.date, LocalTime.of(0, 0)),
- timeId = attendance.timeId
- )
- }, reason)
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/AttendanceSummaryRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/AttendanceSummaryRepository.kt
deleted file mode 100644
index 4edb507b..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/AttendanceSummaryRepository.kt
+++ /dev/null
@@ -1,39 +0,0 @@
-package io.github.wulkanowy.data.repositories
-
-import io.github.wulkanowy.data.db.dao.AttendanceSummaryDao
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.data.mappers.mapToEntities
-import io.github.wulkanowy.sdk.Sdk
-import io.github.wulkanowy.utils.AutoRefreshHelper
-import io.github.wulkanowy.utils.getRefreshKey
-import io.github.wulkanowy.utils.init
-import io.github.wulkanowy.utils.networkBoundResource
-import io.github.wulkanowy.utils.uniqueSubtract
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class AttendanceSummaryRepository @Inject constructor(
- private val attendanceDb: AttendanceSummaryDao,
- private val sdk: Sdk,
- private val refreshHelper: AutoRefreshHelper,
-) {
-
- private val cacheKey = "attendance_summary"
-
- fun getAttendanceSummary(student: Student, semester: Semester, subjectId: Int, forceRefresh: Boolean) = networkBoundResource(
- shouldFetch = { it.isEmpty() || forceRefresh || refreshHelper.isShouldBeRefreshed(getRefreshKey(cacheKey, semester)) },
- query = { attendanceDb.loadAll(semester.diaryId, semester.studentId, subjectId) },
- fetch = {
- sdk.init(student).switchDiary(semester.diaryId, semester.schoolYear)
- .getAttendanceSummary(subjectId)
- .mapToEntities(semester, subjectId)
- },
- saveFetchResult = { old, new ->
- attendanceDb.deleteAll(old uniqueSubtract new)
- attendanceDb.insertAll(new uniqueSubtract old)
- refreshHelper.updateLastRefreshTimestamp(getRefreshKey(cacheKey, semester))
- }
- )
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/CompletedLessonsRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/CompletedLessonsRepository.kt
deleted file mode 100644
index 59aabdd5..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/CompletedLessonsRepository.kt
+++ /dev/null
@@ -1,43 +0,0 @@
-package io.github.wulkanowy.data.repositories
-
-import io.github.wulkanowy.data.db.dao.CompletedLessonsDao
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.data.mappers.mapToEntities
-import io.github.wulkanowy.sdk.Sdk
-import io.github.wulkanowy.utils.AutoRefreshHelper
-import io.github.wulkanowy.utils.getRefreshKey
-import io.github.wulkanowy.utils.init
-import io.github.wulkanowy.utils.monday
-import io.github.wulkanowy.utils.networkBoundResource
-import io.github.wulkanowy.utils.sunday
-import io.github.wulkanowy.utils.uniqueSubtract
-import java.time.LocalDate
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class CompletedLessonsRepository @Inject constructor(
- private val completedLessonsDb: CompletedLessonsDao,
- private val sdk: Sdk,
- private val refreshHelper: AutoRefreshHelper,
-) {
-
- private val cacheKey = "completed"
-
- fun getCompletedLessons(student: Student, semester: Semester, start: LocalDate, end: LocalDate, forceRefresh: Boolean) = networkBoundResource(
- shouldFetch = { it.isEmpty() || forceRefresh || refreshHelper.isShouldBeRefreshed(getRefreshKey(cacheKey, semester, start, end)) },
- query = { completedLessonsDb.loadAll(semester.studentId, semester.diaryId, start.monday, end.sunday) },
- fetch = {
- sdk.init(student).switchDiary(semester.diaryId, semester.schoolYear)
- .getCompletedLessons(start.monday, end.sunday)
- .mapToEntities(semester)
- },
- saveFetchResult = { old, new ->
- completedLessonsDb.deleteAll(old uniqueSubtract new)
- completedLessonsDb.insertAll(new uniqueSubtract old)
- refreshHelper.updateLastRefreshTimestamp(getRefreshKey(cacheKey, semester, start, end))
- },
- filterResult = { it.filter { item -> item.date in start..end } }
- )
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/ConferenceRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/ConferenceRepository.kt
deleted file mode 100644
index befcf9e6..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/ConferenceRepository.kt
+++ /dev/null
@@ -1,39 +0,0 @@
-package io.github.wulkanowy.data.repositories
-
-import io.github.wulkanowy.data.db.dao.ConferenceDao
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.data.mappers.mapToEntities
-import io.github.wulkanowy.sdk.Sdk
-import io.github.wulkanowy.utils.AutoRefreshHelper
-import io.github.wulkanowy.utils.getRefreshKey
-import io.github.wulkanowy.utils.init
-import io.github.wulkanowy.utils.networkBoundResource
-import io.github.wulkanowy.utils.uniqueSubtract
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class ConferenceRepository @Inject constructor(
- private val conferenceDb: ConferenceDao,
- private val sdk: Sdk,
- private val refreshHelper: AutoRefreshHelper,
-) {
-
- private val cacheKey = "conference"
-
- fun getConferences(student: Student, semester: Semester, forceRefresh: Boolean) = networkBoundResource(
- shouldFetch = { it.isEmpty() || forceRefresh || refreshHelper.isShouldBeRefreshed(getRefreshKey(cacheKey, semester)) },
- query = { conferenceDb.loadAll(semester.diaryId, student.studentId) },
- fetch = {
- sdk.init(student).switchDiary(semester.diaryId, semester.schoolYear)
- .getConferences()
- .mapToEntities(semester)
- },
- saveFetchResult = { old, new ->
- conferenceDb.deleteAll(old uniqueSubtract new)
- conferenceDb.insertAll(new uniqueSubtract old)
- refreshHelper.updateLastRefreshTimestamp(getRefreshKey(cacheKey, semester))
- }
- )
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/ExamRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/ExamRepository.kt
deleted file mode 100644
index bd6e7d2d..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/ExamRepository.kt
+++ /dev/null
@@ -1,43 +0,0 @@
-package io.github.wulkanowy.data.repositories
-
-import io.github.wulkanowy.data.db.dao.ExamDao
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.data.mappers.mapToEntities
-import io.github.wulkanowy.sdk.Sdk
-import io.github.wulkanowy.utils.AutoRefreshHelper
-import io.github.wulkanowy.utils.endExamsDay
-import io.github.wulkanowy.utils.getRefreshKey
-import io.github.wulkanowy.utils.init
-import io.github.wulkanowy.utils.networkBoundResource
-import io.github.wulkanowy.utils.startExamsDay
-import io.github.wulkanowy.utils.uniqueSubtract
-import java.time.LocalDate
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class ExamRepository @Inject constructor(
- private val examDb: ExamDao,
- private val sdk: Sdk,
- private val refreshHelper: AutoRefreshHelper,
-) {
-
- private val cacheKey = "exam"
-
- fun getExams(student: Student, semester: Semester, start: LocalDate, end: LocalDate, forceRefresh: Boolean) = networkBoundResource(
- shouldFetch = { it.isEmpty() || forceRefresh || refreshHelper.isShouldBeRefreshed(getRefreshKey(cacheKey, semester, start, end)) },
- query = { examDb.loadAll(semester.diaryId, semester.studentId, start.startExamsDay, start.endExamsDay) },
- fetch = {
- sdk.init(student).switchDiary(semester.diaryId, semester.schoolYear)
- .getExams(start.startExamsDay, start.endExamsDay, semester.semesterId)
- .mapToEntities(semester)
- },
- saveFetchResult = { old, new ->
- examDb.deleteAll(old uniqueSubtract new)
- examDb.insertAll(new uniqueSubtract old)
- refreshHelper.updateLastRefreshTimestamp(getRefreshKey(cacheKey, semester, start, end))
- },
- filterResult = { it.filter { item -> item.date in start..end } }
- )
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/GradeStatisticsRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/GradeStatisticsRepository.kt
deleted file mode 100644
index ab65fb14..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/GradeStatisticsRepository.kt
+++ /dev/null
@@ -1,144 +0,0 @@
-package io.github.wulkanowy.data.repositories
-
-import io.github.wulkanowy.data.db.dao.GradePartialStatisticsDao
-import io.github.wulkanowy.data.db.dao.GradePointsStatisticsDao
-import io.github.wulkanowy.data.db.dao.GradeSemesterStatisticsDao
-import io.github.wulkanowy.data.db.entities.GradePartialStatistics
-import io.github.wulkanowy.data.db.entities.GradeSemesterStatistics
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.data.mappers.mapPartialToStatisticItems
-import io.github.wulkanowy.data.mappers.mapPointsToStatisticsItems
-import io.github.wulkanowy.data.mappers.mapSemesterToStatisticItems
-import io.github.wulkanowy.data.mappers.mapToEntities
-import io.github.wulkanowy.sdk.Sdk
-import io.github.wulkanowy.utils.AutoRefreshHelper
-import io.github.wulkanowy.utils.getRefreshKey
-import io.github.wulkanowy.utils.init
-import io.github.wulkanowy.utils.networkBoundResource
-import io.github.wulkanowy.utils.uniqueSubtract
-import java.util.Locale
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class GradeStatisticsRepository @Inject constructor(
- private val gradePartialStatisticsDb: GradePartialStatisticsDao,
- private val gradePointsStatisticsDb: GradePointsStatisticsDao,
- private val gradeSemesterStatisticsDb: GradeSemesterStatisticsDao,
- private val sdk: Sdk,
- private val refreshHelper: AutoRefreshHelper,
-) {
-
- private val partialCacheKey = "grade_stats_partial"
- private val semesterCacheKey = "grade_stats_semester"
- private val pointsCacheKey = "grade_stats_points"
-
- fun getGradesPartialStatistics(student: Student, semester: Semester, subjectName: String, forceRefresh: Boolean) = networkBoundResource(
- shouldFetch = { it.isEmpty() || forceRefresh || refreshHelper.isShouldBeRefreshed(getRefreshKey(partialCacheKey, semester)) },
- query = { gradePartialStatisticsDb.loadAll(semester.semesterId, semester.studentId) },
- fetch = {
- sdk.init(student).switchDiary(semester.diaryId, semester.schoolYear)
- .getGradesPartialStatistics(semester.semesterId)
- .mapToEntities(semester)
- },
- saveFetchResult = { old, new ->
- gradePartialStatisticsDb.deleteAll(old uniqueSubtract new)
- gradePartialStatisticsDb.insertAll(new uniqueSubtract old)
- refreshHelper.updateLastRefreshTimestamp(getRefreshKey(partialCacheKey, semester))
- },
- mapResult = { items ->
- when (subjectName) {
- "Wszystkie" -> {
- val numerator = items.map {
- it.classAverage.replace(",", ".").toDoubleOrNull() ?: .0
- }.filterNot { it == .0 }
- (items.reversed() + GradePartialStatistics(
- studentId = semester.studentId,
- semesterId = semester.semesterId,
- subject = subjectName,
- classAverage = if (numerator.isEmpty()) "" else numerator.average().let {
- "%.2f".format(Locale.FRANCE, it)
- },
- studentAverage = "",
- classAmounts = items.map { it.classAmounts }.sumGradeAmounts(),
- studentAmounts = items.map { it.studentAmounts }.sumGradeAmounts()
- )).reversed()
- }
- else -> items.filter { it.subject == subjectName }
- }.mapPartialToStatisticItems()
- }
- )
-
- fun getGradesSemesterStatistics(student: Student, semester: Semester, subjectName: String, forceRefresh: Boolean) = networkBoundResource(
- shouldFetch = { it.isEmpty() || forceRefresh || refreshHelper.isShouldBeRefreshed(getRefreshKey(semesterCacheKey, semester)) },
- query = { gradeSemesterStatisticsDb.loadAll(semester.semesterId, semester.studentId) },
- fetch = {
- sdk.init(student).switchDiary(semester.diaryId, semester.schoolYear)
- .getGradesSemesterStatistics(semester.semesterId)
- .mapToEntities(semester)
- },
- saveFetchResult = { old, new ->
- gradeSemesterStatisticsDb.deleteAll(old uniqueSubtract new)
- gradeSemesterStatisticsDb.insertAll(new uniqueSubtract old)
- refreshHelper.updateLastRefreshTimestamp(getRefreshKey(semesterCacheKey, semester))
- },
- mapResult = { items ->
- val itemsWithAverage = items.map { item ->
- item.copy().apply {
- val denominator = item.amounts.sum()
- average = if (denominator == 0) "" else (item.amounts.mapIndexed { gradeValue, amount ->
- (gradeValue + 1) * amount
- }.sum().toDouble() / denominator).let {
- "%.2f".format(Locale.FRANCE, it)
- }
- }
- }
- when (subjectName) {
- "Wszystkie" -> (itemsWithAverage.reversed() + GradeSemesterStatistics(
- studentId = semester.studentId,
- semesterId = semester.semesterId,
- subject = subjectName,
- amounts = itemsWithAverage.map { it.amounts }.sumGradeAmounts(),
- studentGrade = 0
- ).apply {
- average = itemsWithAverage.mapNotNull { it.average.replace(",", ".").toDoubleOrNull() }.average().let {
- "%.2f".format(Locale.FRANCE, it)
- }
- }).reversed()
- else -> itemsWithAverage.filter { it.subject == subjectName }
- }.mapSemesterToStatisticItems()
- }
- )
-
- fun getGradesPointsStatistics(student: Student, semester: Semester, subjectName: String, forceRefresh: Boolean) = networkBoundResource(
- shouldFetch = { it.isEmpty() || forceRefresh || refreshHelper.isShouldBeRefreshed(getRefreshKey(pointsCacheKey, semester)) },
- query = { gradePointsStatisticsDb.loadAll(semester.semesterId, semester.studentId) },
- fetch = {
- sdk.init(student).switchDiary(semester.diaryId, semester.schoolYear)
- .getGradesPointsStatistics(semester.semesterId)
- .mapToEntities(semester)
- },
- saveFetchResult = { old, new ->
- gradePointsStatisticsDb.deleteAll(old uniqueSubtract new)
- gradePointsStatisticsDb.insertAll(new uniqueSubtract old)
- refreshHelper.updateLastRefreshTimestamp(getRefreshKey(pointsCacheKey, semester))
- },
- mapResult = { items ->
- when (subjectName) {
- "Wszystkie" -> items
- else -> items.filter { it.subject == subjectName }
- }.mapPointsToStatisticsItems()
- }
- )
-
- private fun List>.sumGradeAmounts(): List {
- val result = mutableListOf(0, 0, 0, 0, 0, 0)
- forEach {
- it.forEachIndexed { grade, amount ->
- result[grade] += amount
- }
- }
- return result
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/HomeworkRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/HomeworkRepository.kt
deleted file mode 100644
index 7625dbbc..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/HomeworkRepository.kt
+++ /dev/null
@@ -1,50 +0,0 @@
-package io.github.wulkanowy.data.repositories
-
-import io.github.wulkanowy.data.db.dao.HomeworkDao
-import io.github.wulkanowy.data.db.entities.Homework
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.data.mappers.mapToEntities
-import io.github.wulkanowy.sdk.Sdk
-import io.github.wulkanowy.utils.AutoRefreshHelper
-import io.github.wulkanowy.utils.getRefreshKey
-import io.github.wulkanowy.utils.init
-import io.github.wulkanowy.utils.monday
-import io.github.wulkanowy.utils.networkBoundResource
-import io.github.wulkanowy.utils.sunday
-import io.github.wulkanowy.utils.uniqueSubtract
-import java.time.LocalDate
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class HomeworkRepository @Inject constructor(
- private val homeworkDb: HomeworkDao,
- private val sdk: Sdk,
- private val refreshHelper: AutoRefreshHelper,
-) {
-
- private val cacheKey = "homework"
-
- fun getHomework(student: Student, semester: Semester, start: LocalDate, end: LocalDate, forceRefresh: Boolean) = networkBoundResource(
- shouldFetch = { it.isEmpty() || forceRefresh || refreshHelper.isShouldBeRefreshed(getRefreshKey(cacheKey, semester, start, end)) },
- query = { homeworkDb.loadAll(semester.semesterId, semester.studentId, start.monday, end.sunday) },
- fetch = {
- sdk.init(student).switchDiary(semester.diaryId, semester.schoolYear)
- .getHomework(start.monday, end.sunday)
- .mapToEntities(semester)
- },
- saveFetchResult = { old, new ->
- homeworkDb.deleteAll(old uniqueSubtract new)
- homeworkDb.insertAll(new uniqueSubtract old)
-
- refreshHelper.updateLastRefreshTimestamp(getRefreshKey(cacheKey, semester, start, end))
- }
- )
-
- suspend fun toggleDone(homework: Homework) {
- homeworkDb.updateAll(listOf(homework.apply {
- isDone = !isDone
- }))
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/LuckyNumberRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/LuckyNumberRepository.kt
deleted file mode 100644
index 801292b4..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/LuckyNumberRepository.kt
+++ /dev/null
@@ -1,41 +0,0 @@
-package io.github.wulkanowy.data.repositories
-
-import io.github.wulkanowy.data.db.dao.LuckyNumberDao
-import io.github.wulkanowy.data.db.entities.LuckyNumber
-import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.data.mappers.mapToEntity
-import io.github.wulkanowy.sdk.Sdk
-import io.github.wulkanowy.utils.init
-import io.github.wulkanowy.utils.networkBoundResource
-import kotlinx.coroutines.flow.first
-import kotlinx.coroutines.flow.map
-import java.time.LocalDate.now
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class LuckyNumberRepository @Inject constructor(
- private val luckyNumberDb: LuckyNumberDao,
- private val sdk: Sdk
-) {
-
- fun getLuckyNumber(student: Student, forceRefresh: Boolean, notify: Boolean = false) = networkBoundResource(
- shouldFetch = { it == null || forceRefresh },
- query = { luckyNumberDb.load(student.studentId, now()) },
- fetch = { sdk.init(student).getLuckyNumber(student.schoolShortName)?.mapToEntity(student) },
- saveFetchResult = { old, new ->
- if (new != old) {
- old?.let { luckyNumberDb.deleteAll(listOfNotNull(it)) }
- luckyNumberDb.insertAll(listOfNotNull((new?.apply {
- if (notify) isNotified = false
- })))
- }
- }
- )
-
- suspend fun getNotNotifiedLuckyNumber(student: Student) = luckyNumberDb.load(student.studentId, now()).map {
- if (it?.isNotified == false) it else null
- }.first()
-
- suspend fun updateLuckyNumber(luckyNumber: LuckyNumber?) = luckyNumberDb.updateAll(listOfNotNull(luckyNumber))
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/MessageRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/MessageRepository.kt
deleted file mode 100644
index ea7b2b0e..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/MessageRepository.kt
+++ /dev/null
@@ -1,102 +0,0 @@
-package io.github.wulkanowy.data.repositories
-
-import io.github.wulkanowy.data.db.dao.MessageAttachmentDao
-import io.github.wulkanowy.data.db.dao.MessagesDao
-import io.github.wulkanowy.data.db.entities.Message
-import io.github.wulkanowy.data.db.entities.Recipient
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.data.enums.MessageFolder
-import io.github.wulkanowy.data.enums.MessageFolder.RECEIVED
-import io.github.wulkanowy.data.mappers.mapFromEntities
-import io.github.wulkanowy.data.mappers.mapToEntities
-import io.github.wulkanowy.sdk.Sdk
-import io.github.wulkanowy.sdk.pojo.Folder
-import io.github.wulkanowy.sdk.pojo.SentMessage
-import io.github.wulkanowy.utils.AutoRefreshHelper
-import io.github.wulkanowy.utils.getRefreshKey
-import io.github.wulkanowy.utils.init
-import io.github.wulkanowy.utils.networkBoundResource
-import io.github.wulkanowy.utils.uniqueSubtract
-import kotlinx.coroutines.flow.Flow
-import kotlinx.coroutines.flow.map
-import timber.log.Timber
-import java.time.LocalDateTime.now
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class MessageRepository @Inject constructor(
- private val messagesDb: MessagesDao,
- private val messageAttachmentDao: MessageAttachmentDao,
- private val sdk: Sdk,
- private val refreshHelper: AutoRefreshHelper,
-) {
-
- private val cacheKey = "message"
-
- @Suppress("UNUSED_PARAMETER")
- fun getMessages(student: Student, semester: Semester, folder: MessageFolder, forceRefresh: Boolean, notify: Boolean = false) = networkBoundResource(
- shouldFetch = { it.isEmpty() || forceRefresh || refreshHelper.isShouldBeRefreshed(getRefreshKey(cacheKey, student, folder)) },
- query = { messagesDb.loadAll(student.id.toInt(), folder.id) },
- fetch = { sdk.init(student).getMessages(Folder.valueOf(folder.name), now().minusMonths(3), now()).mapToEntities(student) },
- saveFetchResult = { old, new ->
- messagesDb.deleteAll(old uniqueSubtract new)
- messagesDb.insertAll((new uniqueSubtract old).onEach {
- it.isNotified = !notify
- })
-
- refreshHelper.updateLastRefreshTimestamp(getRefreshKey(cacheKey, student, folder))
- }
- )
-
- fun getMessage(student: Student, message: Message, markAsRead: Boolean = false) = networkBoundResource(
- shouldFetch = {
- checkNotNull(it, { "This message no longer exist!" })
- Timber.d("Message content in db empty: ${it.message.content.isEmpty()}")
- it.message.unread || it.message.content.isEmpty()
- },
- query = { messagesDb.loadMessageWithAttachment(student.id.toInt(), message.messageId) },
- fetch = {
- sdk.init(student).getMessageDetails(it!!.message.messageId, message.folderId, markAsRead, message.realId).let { details ->
- details.content to details.attachments.mapToEntities()
- }
- },
- saveFetchResult = { old, (downloadedMessage, attachments) ->
- checkNotNull(old, { "Fetched message no longer exist!" })
- messagesDb.updateAll(listOf(old.message.copy(unread = !markAsRead).apply {
- id = old.message.id
- content = content.ifBlank { downloadedMessage }
- }))
- messageAttachmentDao.insertAttachments(attachments)
- Timber.d("Message ${message.messageId} with blank content: ${old.message.content.isBlank()}, marked as read")
- }
- )
-
- fun getNotNotifiedMessages(student: Student): Flow> {
- return messagesDb.loadAll(student.id.toInt(), RECEIVED.id).map { it.filter { message -> !message.isNotified && message.unread } }
- }
-
- suspend fun updateMessages(messages: List) {
- return messagesDb.updateAll(messages)
- }
-
- suspend fun sendMessage(student: Student, subject: String, content: String, recipients: List): SentMessage {
- return sdk.init(student).sendMessage(
- subject = subject,
- content = content,
- recipients = recipients.mapFromEntities()
- )
- }
-
- suspend fun deleteMessage(student: Student, message: Message) {
- val isDeleted = sdk.init(student).deleteMessages(listOf(message.messageId), message.folderId)
-
- if (message.folderId != MessageFolder.TRASHED.id) {
- if (isDeleted) messagesDb.updateAll(listOf(message.copy(folderId = MessageFolder.TRASHED.id).apply {
- id = message.id
- content = message.content
- }))
- } else messagesDb.deleteAll(listOf(message))
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/MobileDeviceRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/MobileDeviceRepository.kt
deleted file mode 100644
index 7e83ef7d..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/MobileDeviceRepository.kt
+++ /dev/null
@@ -1,56 +0,0 @@
-package io.github.wulkanowy.data.repositories
-
-import io.github.wulkanowy.data.db.dao.MobileDeviceDao
-import io.github.wulkanowy.data.db.entities.MobileDevice
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.data.mappers.mapToEntities
-import io.github.wulkanowy.data.mappers.mapToMobileDeviceToken
-import io.github.wulkanowy.data.pojos.MobileDeviceToken
-import io.github.wulkanowy.sdk.Sdk
-import io.github.wulkanowy.utils.AutoRefreshHelper
-import io.github.wulkanowy.utils.getRefreshKey
-import io.github.wulkanowy.utils.init
-import io.github.wulkanowy.utils.networkBoundResource
-import io.github.wulkanowy.utils.uniqueSubtract
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class MobileDeviceRepository @Inject constructor(
- private val mobileDb: MobileDeviceDao,
- private val sdk: Sdk,
- private val refreshHelper: AutoRefreshHelper,
-) {
-
- private val cacheKey = "devices"
-
- fun getDevices(student: Student, semester: Semester, forceRefresh: Boolean) = networkBoundResource(
- shouldFetch = { it.isEmpty() || forceRefresh || refreshHelper.isShouldBeRefreshed(getRefreshKey(cacheKey, student)) },
- query = { mobileDb.loadAll(student.userLoginId.takeIf { it != 0 } ?: student.studentId) },
- fetch = {
- sdk.init(student).switchDiary(semester.diaryId, semester.schoolYear)
- .getRegisteredDevices()
- .mapToEntities(semester)
- },
- saveFetchResult = { old, new ->
- mobileDb.deleteAll(old uniqueSubtract new)
- mobileDb.insertAll(new uniqueSubtract old)
-
- refreshHelper.updateLastRefreshTimestamp(getRefreshKey(cacheKey, student))
- }
- )
-
- suspend fun unregisterDevice(student: Student, semester: Semester, device: MobileDevice) {
- sdk.init(student).switchDiary(semester.diaryId, semester.schoolYear)
- .unregisterDevice(device.deviceId)
-
- mobileDb.deleteAll(listOf(device))
- }
-
- suspend fun getToken(student: Student, semester: Semester): MobileDeviceToken {
- return sdk.init(student).switchDiary(semester.diaryId, semester.schoolYear)
- .getToken()
- .mapToMobileDeviceToken()
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/NoteRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/NoteRepository.kt
deleted file mode 100644
index 85789f09..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/NoteRepository.kt
+++ /dev/null
@@ -1,60 +0,0 @@
-package io.github.wulkanowy.data.repositories
-
-import io.github.wulkanowy.data.db.dao.NoteDao
-import io.github.wulkanowy.data.db.entities.Note
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.data.mappers.mapToEntities
-import io.github.wulkanowy.sdk.Sdk
-import io.github.wulkanowy.utils.AutoRefreshHelper
-import io.github.wulkanowy.utils.getRefreshKey
-import io.github.wulkanowy.utils.init
-import io.github.wulkanowy.utils.networkBoundResource
-import io.github.wulkanowy.utils.uniqueSubtract
-import kotlinx.coroutines.flow.Flow
-import kotlinx.coroutines.flow.map
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class NoteRepository @Inject constructor(
- private val noteDb: NoteDao,
- private val sdk: Sdk,
- private val refreshHelper: AutoRefreshHelper,
-) {
-
- private val cacheKey = "note"
-
- fun getNotes(student: Student, semester: Semester, forceRefresh: Boolean, notify: Boolean = false) = networkBoundResource(
- shouldFetch = { it.isEmpty() || forceRefresh || refreshHelper.isShouldBeRefreshed(getRefreshKey(cacheKey, semester)) },
- query = { noteDb.loadAll(student.studentId) },
- fetch = {
- sdk.init(student).switchDiary(semester.diaryId, semester.schoolYear)
- .getNotes(semester.semesterId)
- .mapToEntities(semester)
- },
- saveFetchResult = { old, new ->
- noteDb.deleteAll(old uniqueSubtract new)
- noteDb.insertAll((new uniqueSubtract old).onEach {
- if (it.date >= student.registrationDate.toLocalDate()) it.apply {
- isRead = false
- if (notify) isNotified = false
- }
- })
-
- refreshHelper.updateLastRefreshTimestamp(getRefreshKey(cacheKey, semester))
- }
- )
-
- fun getNotNotifiedNotes(student: Student): Flow> {
- return noteDb.loadAll(student.studentId).map { it.filter { note -> !note.isNotified } }
- }
-
- suspend fun updateNote(note: Note) {
- noteDb.updateAll(listOf(note))
- }
-
- suspend fun updateNotes(notes: List) {
- noteDb.updateAll(notes)
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/RecipientRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/RecipientRepository.kt
deleted file mode 100644
index 24ab5f0c..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/RecipientRepository.kt
+++ /dev/null
@@ -1,40 +0,0 @@
-package io.github.wulkanowy.data.repositories
-
-import io.github.wulkanowy.data.db.dao.RecipientDao
-import io.github.wulkanowy.data.db.entities.Message
-import io.github.wulkanowy.data.db.entities.Recipient
-import io.github.wulkanowy.data.db.entities.ReportingUnit
-import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.data.mappers.mapToEntities
-import io.github.wulkanowy.sdk.Sdk
-import io.github.wulkanowy.utils.init
-import io.github.wulkanowy.utils.uniqueSubtract
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class RecipientRepository @Inject constructor(
- private val recipientDb: RecipientDao,
- private val sdk: Sdk
-) {
-
- suspend fun refreshRecipients(student: Student, unit: ReportingUnit, role: Int) {
- val new = sdk.init(student).getRecipients(unit.unitId, role).mapToEntities(unit.senderId)
- val old = recipientDb.loadAll(unit.senderId, unit.unitId, role)
-
- recipientDb.deleteAll(old uniqueSubtract new)
- recipientDb.insertAll(new uniqueSubtract old)
- }
-
- suspend fun getRecipients(student: Student, unit: ReportingUnit, role: Int): List {
- return recipientDb.loadAll(unit.senderId, unit.unitId, role).ifEmpty {
- refreshRecipients(student, unit, role)
-
- recipientDb.loadAll(unit.senderId, unit.unitId, role)
- }
- }
-
- suspend fun getMessageRecipients(student: Student, message: Message): List {
- return sdk.init(student).getMessageRecipients(message.messageId, message.senderId).mapToEntities(student.userLoginId)
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/ReportingUnitRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/ReportingUnitRepository.kt
deleted file mode 100644
index 792e66b5..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/ReportingUnitRepository.kt
+++ /dev/null
@@ -1,42 +0,0 @@
-package io.github.wulkanowy.data.repositories
-
-import io.github.wulkanowy.data.db.dao.ReportingUnitDao
-import io.github.wulkanowy.data.db.entities.ReportingUnit
-import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.data.mappers.mapToEntities
-import io.github.wulkanowy.sdk.Sdk
-import io.github.wulkanowy.utils.init
-import io.github.wulkanowy.utils.uniqueSubtract
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class ReportingUnitRepository @Inject constructor(
- private val reportingUnitDb: ReportingUnitDao,
- private val sdk: Sdk
-) {
-
- suspend fun refreshReportingUnits(student: Student) {
- val new = sdk.init(student).getReportingUnits().mapToEntities(student)
- val old = reportingUnitDb.load(student.studentId)
-
- reportingUnitDb.deleteAll(old.uniqueSubtract(new))
- reportingUnitDb.insertAll(new.uniqueSubtract(old))
- }
-
- suspend fun getReportingUnits(student: Student): List {
- return reportingUnitDb.load(student.studentId).ifEmpty {
- refreshReportingUnits(student)
-
- reportingUnitDb.load(student.studentId)
- }
- }
-
- suspend fun getReportingUnit(student: Student, unitId: Int): ReportingUnit? {
- return reportingUnitDb.loadOne(student.studentId, unitId) ?: run {
- refreshReportingUnits(student)
-
- return reportingUnitDb.loadOne(student.studentId, unitId)
- }
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/SchoolRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/SchoolRepository.kt
deleted file mode 100644
index 6b22b32c..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/SchoolRepository.kt
+++ /dev/null
@@ -1,38 +0,0 @@
-package io.github.wulkanowy.data.repositories
-
-import io.github.wulkanowy.data.db.dao.SchoolDao
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.data.mappers.mapToEntity
-import io.github.wulkanowy.sdk.Sdk
-import io.github.wulkanowy.utils.init
-import io.github.wulkanowy.utils.networkBoundResource
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class SchoolRepository @Inject constructor(
- private val schoolDb: SchoolDao,
- private val sdk: Sdk
-) {
-
- fun getSchoolInfo(student: Student, semester: Semester, forceRefresh: Boolean) =
- networkBoundResource(
- shouldFetch = { it == null || forceRefresh },
- query = { schoolDb.load(semester.studentId, semester.classId) },
- fetch = {
- sdk.init(student).switchDiary(semester.diaryId, semester.schoolYear).getSchool()
- .mapToEntity(semester)
- },
- saveFetchResult = { old, new ->
- if (old != null && new != old) {
- with(schoolDb) {
- deleteAll(listOf(old))
- insertAll(listOf(new))
- }
- } else if (old == null) {
- schoolDb.insertAll(listOf(new))
- }
- }
- )
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/StudentInfoRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/StudentInfoRepository.kt
deleted file mode 100644
index e3deb447..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/StudentInfoRepository.kt
+++ /dev/null
@@ -1,38 +0,0 @@
-package io.github.wulkanowy.data.repositories
-
-import io.github.wulkanowy.data.db.dao.StudentInfoDao
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.data.mappers.mapToEntity
-import io.github.wulkanowy.sdk.Sdk
-import io.github.wulkanowy.utils.init
-import io.github.wulkanowy.utils.networkBoundResource
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class StudentInfoRepository @Inject constructor(
- private val studentInfoDao: StudentInfoDao,
- private val sdk: Sdk
-) {
-
- fun getStudentInfo(student: Student, semester: Semester, forceRefresh: Boolean) =
- networkBoundResource(
- shouldFetch = { it == null || forceRefresh },
- query = { studentInfoDao.loadStudentInfo(student.studentId) },
- fetch = {
- sdk.init(student).switchDiary(semester.diaryId, semester.schoolYear)
- .getStudentInfo().mapToEntity(semester)
- },
- saveFetchResult = { old, new ->
- if (old != null && new != old) {
- with(studentInfoDao) {
- deleteAll(listOf(old))
- insertAll(listOf(new))
- }
- } else if (old == null) {
- studentInfoDao.insertAll(listOf(new))
- }
- }
- )
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/StudentRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/StudentRepository.kt
deleted file mode 100644
index 55821479..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/StudentRepository.kt
+++ /dev/null
@@ -1,107 +0,0 @@
-package io.github.wulkanowy.data.repositories
-
-import android.content.Context
-import dagger.hilt.android.qualifiers.ApplicationContext
-import io.github.wulkanowy.data.db.dao.SemesterDao
-import io.github.wulkanowy.data.db.dao.StudentDao
-import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.data.db.entities.StudentNick
-import io.github.wulkanowy.data.db.entities.StudentWithSemesters
-import io.github.wulkanowy.data.exceptions.NoCurrentStudentException
-import io.github.wulkanowy.data.mappers.mapToEntities
-import io.github.wulkanowy.sdk.Sdk
-import io.github.wulkanowy.utils.DispatchersProvider
-import io.github.wulkanowy.utils.security.decrypt
-import io.github.wulkanowy.utils.security.encrypt
-import kotlinx.coroutines.withContext
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class StudentRepository @Inject constructor(
- @ApplicationContext private val context: Context,
- private val dispatchers: DispatchersProvider,
- private val studentDb: StudentDao,
- private val semesterDb: SemesterDao,
- private val sdk: Sdk
-) {
-
- suspend fun isStudentSaved() = getSavedStudents(false).isNotEmpty()
-
- suspend fun isCurrentStudentSet() = studentDb.loadCurrent()?.isCurrent ?: false
-
- suspend fun getStudentsApi(
- pin: String,
- symbol: String,
- token: String
- ): List =
- sdk.getStudentsFromMobileApi(token, pin, symbol, "").mapToEntities()
-
- suspend fun getStudentsScrapper(
- email: String,
- password: String,
- scrapperBaseUrl: String,
- symbol: String
- ): List =
- sdk.getStudentsFromScrapper(email, password, scrapperBaseUrl, symbol)
- .mapToEntities(password)
-
- suspend fun getStudentsHybrid(
- email: String,
- password: String,
- scrapperBaseUrl: String,
- symbol: String
- ): List =
- sdk.getStudentsHybrid(email, password, scrapperBaseUrl, "", symbol).mapToEntities(password)
-
- suspend fun getSavedStudents(decryptPass: Boolean = true) =
- withContext(dispatchers.backgroundThread) {
- studentDb.loadStudentsWithSemesters().map {
- it.apply {
- if (decryptPass && Sdk.Mode.valueOf(student.loginMode) != Sdk.Mode.API) {
- student.password = decrypt(student.password)
- }
- }
- }
- }
-
- suspend fun getStudentById(id: Int) = withContext(dispatchers.backgroundThread) {
- studentDb.loadById(id)?.apply {
- if (Sdk.Mode.valueOf(loginMode) != Sdk.Mode.API) {
- password = decrypt(password)
- }
- }
- } ?: throw NoCurrentStudentException()
-
- suspend fun getCurrentStudent(decryptPass: Boolean = true) =
- withContext(dispatchers.backgroundThread) {
- studentDb.loadCurrent()?.apply {
- if (decryptPass && Sdk.Mode.valueOf(loginMode) != Sdk.Mode.API) {
- password = decrypt(password)
- }
- }
- } ?: throw NoCurrentStudentException()
-
- suspend fun saveStudents(studentsWithSemesters: List): List {
- semesterDb.insertSemesters(studentsWithSemesters.flatMap { it.semesters })
-
- return withContext(dispatchers.backgroundThread) {
- studentDb.insertAll(studentsWithSemesters.map { it.student }.map {
- if (Sdk.Mode.valueOf(it.loginMode) != Sdk.Mode.API) {
- it.copy(password = encrypt(it.password, context))
- } else it
- })
- }
- }
-
- suspend fun switchStudent(studentWithSemesters: StudentWithSemesters) {
- with(studentDb) {
- resetCurrent()
- updateCurrent(studentWithSemesters.student.id)
- }
- }
-
- suspend fun logoutStudent(student: Student) = studentDb.delete(student)
-
- suspend fun updateStudentNick(studentNick: StudentNick) = studentDb.update(studentNick)
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/SubjectRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/SubjectRepository.kt
deleted file mode 100644
index ef07a1d4..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/SubjectRepository.kt
+++ /dev/null
@@ -1,32 +0,0 @@
-package io.github.wulkanowy.data.repositories
-
-import io.github.wulkanowy.data.db.dao.SubjectDao
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.data.mappers.mapToEntities
-import io.github.wulkanowy.sdk.Sdk
-import io.github.wulkanowy.utils.init
-import io.github.wulkanowy.utils.networkBoundResource
-import io.github.wulkanowy.utils.uniqueSubtract
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class SubjectRepository @Inject constructor(
- private val subjectDao: SubjectDao,
- private val sdk: Sdk
-) {
-
- fun getSubjects(student: Student, semester: Semester, forceRefresh: Boolean = false) = networkBoundResource(
- shouldFetch = { it.isEmpty() || forceRefresh },
- query = { subjectDao.loadAll(semester.diaryId, semester.studentId) },
- fetch = {
- sdk.init(student).switchDiary(semester.diaryId, semester.schoolYear)
- .getSubjects().mapToEntities(semester)
- },
- saveFetchResult = { old, new ->
- subjectDao.deleteAll(old uniqueSubtract new)
- subjectDao.insertAll(new uniqueSubtract old)
- }
- )
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/TeacherRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/TeacherRepository.kt
deleted file mode 100644
index 25da718c..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/TeacherRepository.kt
+++ /dev/null
@@ -1,33 +0,0 @@
-package io.github.wulkanowy.data.repositories
-
-import io.github.wulkanowy.data.db.dao.TeacherDao
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.data.mappers.mapToEntities
-import io.github.wulkanowy.sdk.Sdk
-import io.github.wulkanowy.utils.init
-import io.github.wulkanowy.utils.networkBoundResource
-import io.github.wulkanowy.utils.uniqueSubtract
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class TeacherRepository @Inject constructor(
- private val teacherDb: TeacherDao,
- private val sdk: Sdk
-) {
-
- fun getTeachers(student: Student, semester: Semester, forceRefresh: Boolean) = networkBoundResource(
- shouldFetch = { it.isEmpty() || forceRefresh },
- query = { teacherDb.loadAll(semester.studentId, semester.classId) },
- fetch = {
- sdk.init(student).switchDiary(semester.diaryId, semester.schoolYear)
- .getTeachers(semester.semesterId)
- .mapToEntities(semester)
- },
- saveFetchResult = { old, new ->
- teacherDb.deleteAll(old uniqueSubtract new)
- teacherDb.insertAll(new uniqueSubtract old)
- }
- )
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/TimetableRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/TimetableRepository.kt
deleted file mode 100644
index fa1898f5..00000000
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/TimetableRepository.kt
+++ /dev/null
@@ -1,84 +0,0 @@
-package io.github.wulkanowy.data.repositories
-
-import io.github.wulkanowy.data.db.dao.TimetableAdditionalDao
-import io.github.wulkanowy.data.db.dao.TimetableDao
-import io.github.wulkanowy.data.db.entities.Semester
-import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.data.db.entities.Timetable
-import io.github.wulkanowy.data.db.entities.TimetableAdditional
-import io.github.wulkanowy.data.mappers.mapToEntities
-import io.github.wulkanowy.sdk.Sdk
-import io.github.wulkanowy.services.alarm.TimetableNotificationSchedulerHelper
-import io.github.wulkanowy.utils.AutoRefreshHelper
-import io.github.wulkanowy.utils.getRefreshKey
-import io.github.wulkanowy.utils.init
-import io.github.wulkanowy.utils.monday
-import io.github.wulkanowy.utils.networkBoundResource
-import io.github.wulkanowy.utils.sunday
-import io.github.wulkanowy.utils.uniqueSubtract
-import kotlinx.coroutines.flow.combine
-import kotlinx.coroutines.flow.map
-import java.time.LocalDate
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class TimetableRepository @Inject constructor(
- private val timetableDb: TimetableDao,
- private val timetableAdditionalDb: TimetableAdditionalDao,
- private val sdk: Sdk,
- private val schedulerHelper: TimetableNotificationSchedulerHelper,
- private val refreshHelper: AutoRefreshHelper,
-) {
-
- private val cacheKey = "timetable"
-
- fun getTimetable(student: Student, semester: Semester, start: LocalDate, end: LocalDate, forceRefresh: Boolean, refreshAdditional: Boolean = false) = networkBoundResource(
- shouldFetch = { (timetable, additional) -> timetable.isEmpty() || (additional.isEmpty() && refreshAdditional) || forceRefresh || refreshHelper.isShouldBeRefreshed(getRefreshKey(cacheKey, semester, start, end)) },
- query = {
- timetableDb.loadAll(semester.diaryId, semester.studentId, start.monday, end.sunday)
- .map { schedulerHelper.scheduleNotifications(it, student); it }
- .combine(timetableAdditionalDb.loadAll(semester.diaryId, semester.studentId, start.monday, end.sunday)) { timetable, additional ->
- timetable to additional
- }
- },
- fetch = {
- sdk.init(student).switchDiary(semester.diaryId, semester.schoolYear)
- .getTimetable(start.monday, end.sunday)
- .let { (normal, additional) -> normal.mapToEntities(semester) to additional.mapToEntities(semester) }
-
- },
- saveFetchResult = { (oldTimetable, oldAdditional), (newTimetable, newAdditional) ->
- refreshTimetable(student, oldTimetable, newTimetable)
- refreshAdditional(oldAdditional, newAdditional)
-
- refreshHelper.updateLastRefreshTimestamp(getRefreshKey(cacheKey, semester, start, end))
- },
- filterResult = { (timetable, additional) ->
- timetable.filter { item ->
- item.date in start..end
- } to additional.filter { item ->
- item.date in start..end
- }
- }
- )
-
- private suspend fun refreshTimetable(student: Student, old: List, new: List) {
- timetableDb.deleteAll(old.uniqueSubtract(new).also { schedulerHelper.cancelScheduled(it) })
- timetableDb.insertAll(new.uniqueSubtract(old).also { schedulerHelper.scheduleNotifications(it, student) }.map { item ->
- item.also { new ->
- old.singleOrNull { new.start == it.start }?.let { old ->
- return@map new.copy(
- room = if (new.room.isEmpty()) old.room else new.room,
- teacher = if (new.teacher.isEmpty() && !new.changes && !old.changes) old.teacher else new.teacher
- )
- }
- }
- })
- }
-
- private suspend fun refreshAdditional(old: List, new: List) {
- timetableAdditionalDb.deleteAll(old.uniqueSubtract(new))
- timetableAdditionalDb.insertAll(new.uniqueSubtract(old))
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/AppCreatorRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/appcreator/AppCreatorRepository.kt
similarity index 93%
rename from app/src/main/java/io/github/wulkanowy/data/repositories/AppCreatorRepository.kt
rename to app/src/main/java/io/github/wulkanowy/data/repositories/appcreator/AppCreatorRepository.kt
index aea8632a..ff538969 100644
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/AppCreatorRepository.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/appcreator/AppCreatorRepository.kt
@@ -1,4 +1,4 @@
-package io.github.wulkanowy.data.repositories
+package io.github.wulkanowy.data.repositories.appcreator
import android.content.res.AssetManager
import com.squareup.moshi.Moshi
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/attendance/AttendanceLocal.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/attendance/AttendanceLocal.kt
new file mode 100644
index 00000000..9aaa5230
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/attendance/AttendanceLocal.kt
@@ -0,0 +1,25 @@
+package io.github.wulkanowy.data.repositories.attendance
+
+import io.github.wulkanowy.data.db.dao.AttendanceDao
+import io.github.wulkanowy.data.db.entities.Attendance
+import io.github.wulkanowy.data.db.entities.Semester
+import kotlinx.coroutines.flow.Flow
+import java.time.LocalDate
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class AttendanceLocal @Inject constructor(private val attendanceDb: AttendanceDao) {
+
+ suspend fun saveAttendance(attendance: List) {
+ attendanceDb.insertAll(attendance)
+ }
+
+ suspend fun deleteAttendance(attendance: List) {
+ attendanceDb.deleteAll(attendance)
+ }
+
+ fun getAttendance(semester: Semester, startDate: LocalDate, endDate: LocalDate): Flow> {
+ return attendanceDb.loadAll(semester.diaryId, semester.studentId, startDate, endDate)
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/attendance/AttendanceRemote.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/attendance/AttendanceRemote.kt
new file mode 100644
index 00000000..870690ec
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/attendance/AttendanceRemote.kt
@@ -0,0 +1,50 @@
+package io.github.wulkanowy.data.repositories.attendance
+
+import io.github.wulkanowy.data.db.entities.Attendance
+import io.github.wulkanowy.data.db.entities.Semester
+import io.github.wulkanowy.data.db.entities.Student
+import io.github.wulkanowy.sdk.Sdk
+import io.github.wulkanowy.sdk.pojo.Absent
+import io.github.wulkanowy.utils.init
+import java.time.LocalDate
+import java.time.LocalDateTime
+import java.time.LocalTime
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class AttendanceRemote @Inject constructor(private val sdk: Sdk) {
+
+ suspend fun getAttendance(student: Student, semester: Semester, startDate: LocalDate, endDate: LocalDate): List {
+ return sdk.init(student).switchDiary(semester.diaryId, semester.schoolYear)
+ .getAttendance(startDate, endDate, semester.semesterId)
+ .map {
+ Attendance(
+ studentId = semester.studentId,
+ diaryId = semester.diaryId,
+ date = it.date,
+ timeId = it.timeId,
+ number = it.number,
+ subject = it.subject,
+ name = it.name,
+ presence = it.presence,
+ absence = it.absence,
+ exemption = it.exemption,
+ lateness = it.lateness,
+ excused = it.excused,
+ deleted = it.deleted,
+ excusable = it.excusable,
+ excuseStatus = it.excuseStatus?.name
+ )
+ }
+ }
+
+ suspend fun excuseAbsence(student: Student, semester: Semester, absenceList: List, reason: String?): Boolean {
+ return sdk.init(student).switchDiary(semester.diaryId, semester.schoolYear).excuseForAbsence(absenceList.map { attendance ->
+ Absent(
+ date = LocalDateTime.of(attendance.date, LocalTime.of(0, 0)),
+ timeId = attendance.timeId
+ )
+ }, reason)
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/attendance/AttendanceRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/attendance/AttendanceRepository.kt
new file mode 100644
index 00000000..60f864f2
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/attendance/AttendanceRepository.kt
@@ -0,0 +1,34 @@
+package io.github.wulkanowy.data.repositories.attendance
+
+import io.github.wulkanowy.data.db.entities.Attendance
+import io.github.wulkanowy.data.db.entities.Semester
+import io.github.wulkanowy.data.db.entities.Student
+import io.github.wulkanowy.utils.monday
+import io.github.wulkanowy.utils.networkBoundResource
+import io.github.wulkanowy.utils.sunday
+import io.github.wulkanowy.utils.uniqueSubtract
+import java.time.LocalDate
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class AttendanceRepository @Inject constructor(
+ private val local: AttendanceLocal,
+ private val remote: AttendanceRemote
+) {
+
+ fun getAttendance(student: Student, semester: Semester, start: LocalDate, end: LocalDate, forceRefresh: Boolean) = networkBoundResource(
+ shouldFetch = { it.isEmpty() || forceRefresh },
+ query = { local.getAttendance(semester, start.monday, end.sunday) },
+ fetch = { remote.getAttendance(student, semester, start.monday, end.sunday) },
+ saveFetchResult = { old, new ->
+ local.deleteAttendance(old uniqueSubtract new)
+ local.saveAttendance(new uniqueSubtract old)
+ },
+ filterResult = { it.filter { item -> item.date in start..end } }
+ )
+
+ suspend fun excuseForAbsence(student: Student, semester: Semester, attendanceList: List, reason: String? = null) {
+ remote.excuseAbsence(student, semester, attendanceList, reason)
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/enums/SentExcuseStatus.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/attendance/SentExcuseStatus.kt
similarity index 60%
rename from app/src/main/java/io/github/wulkanowy/data/enums/SentExcuseStatus.kt
rename to app/src/main/java/io/github/wulkanowy/data/repositories/attendance/SentExcuseStatus.kt
index 99878152..50d6b8ed 100644
--- a/app/src/main/java/io/github/wulkanowy/data/enums/SentExcuseStatus.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/attendance/SentExcuseStatus.kt
@@ -1,4 +1,4 @@
-package io.github.wulkanowy.data.enums
+package io.github.wulkanowy.data.repositories.attendance
enum class SentExcuseStatus(val id: Int = 0) {
WAITING,
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/attendancesummary/AttendanceSummaryLocal.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/attendancesummary/AttendanceSummaryLocal.kt
new file mode 100644
index 00000000..703bc947
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/attendancesummary/AttendanceSummaryLocal.kt
@@ -0,0 +1,24 @@
+package io.github.wulkanowy.data.repositories.attendancesummary
+
+import io.github.wulkanowy.data.db.dao.AttendanceSummaryDao
+import io.github.wulkanowy.data.db.entities.AttendanceSummary
+import io.github.wulkanowy.data.db.entities.Semester
+import kotlinx.coroutines.flow.Flow
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class AttendanceSummaryLocal @Inject constructor(private val attendanceDb: AttendanceSummaryDao) {
+
+ suspend fun saveAttendanceSummary(attendance: List) {
+ attendanceDb.insertAll(attendance)
+ }
+
+ suspend fun deleteAttendanceSummary(attendance: List) {
+ attendanceDb.deleteAll(attendance)
+ }
+
+ fun getAttendanceSummary(semester: Semester, subjectId: Int): Flow> {
+ return attendanceDb.loadAll(semester.diaryId, semester.studentId, subjectId)
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/attendancesummary/AttendanceSummaryRemote.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/attendancesummary/AttendanceSummaryRemote.kt
new file mode 100644
index 00000000..29a0b9a7
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/attendancesummary/AttendanceSummaryRemote.kt
@@ -0,0 +1,33 @@
+package io.github.wulkanowy.data.repositories.attendancesummary
+
+import io.github.wulkanowy.data.db.entities.AttendanceSummary
+import io.github.wulkanowy.data.db.entities.Semester
+import io.github.wulkanowy.data.db.entities.Student
+import io.github.wulkanowy.sdk.Sdk
+import io.github.wulkanowy.utils.init
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class AttendanceSummaryRemote @Inject constructor(private val sdk: Sdk) {
+
+ suspend fun getAttendanceSummary(student: Student, semester: Semester, subjectId: Int): List {
+ return sdk.init(student).switchDiary(semester.diaryId, semester.schoolYear)
+ .getAttendanceSummary(subjectId)
+ .map {
+ AttendanceSummary(
+ studentId = semester.studentId,
+ diaryId = semester.diaryId,
+ subjectId = subjectId,
+ month = it.month,
+ presence = it.presence,
+ absence = it.absence,
+ absenceExcused = it.absenceExcused,
+ absenceForSchoolReasons = it.absenceForSchoolReasons,
+ lateness = it.lateness,
+ latenessExcused = it.latenessExcused,
+ exemption = it.exemption
+ )
+ }
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/attendancesummary/AttendanceSummaryRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/attendancesummary/AttendanceSummaryRepository.kt
new file mode 100644
index 00000000..5dbe1ab0
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/attendancesummary/AttendanceSummaryRepository.kt
@@ -0,0 +1,25 @@
+package io.github.wulkanowy.data.repositories.attendancesummary
+
+import io.github.wulkanowy.data.db.entities.Semester
+import io.github.wulkanowy.data.db.entities.Student
+import io.github.wulkanowy.utils.networkBoundResource
+import io.github.wulkanowy.utils.uniqueSubtract
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class AttendanceSummaryRepository @Inject constructor(
+ private val local: AttendanceSummaryLocal,
+ private val remote: AttendanceSummaryRemote
+) {
+
+ fun getAttendanceSummary(student: Student, semester: Semester, subjectId: Int, forceRefresh: Boolean) = networkBoundResource(
+ shouldFetch = { it.isEmpty() || forceRefresh },
+ query = { local.getAttendanceSummary(semester, subjectId) },
+ fetch = { remote.getAttendanceSummary(student, semester, subjectId) },
+ saveFetchResult = { old, new ->
+ local.deleteAttendanceSummary(old uniqueSubtract new)
+ local.saveAttendanceSummary(new uniqueSubtract old)
+ }
+ )
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/completedlessons/CompletedLessonsLocal.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/completedlessons/CompletedLessonsLocal.kt
new file mode 100644
index 00000000..51a1bdbf
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/completedlessons/CompletedLessonsLocal.kt
@@ -0,0 +1,25 @@
+package io.github.wulkanowy.data.repositories.completedlessons
+
+import io.github.wulkanowy.data.db.dao.CompletedLessonsDao
+import io.github.wulkanowy.data.db.entities.CompletedLesson
+import io.github.wulkanowy.data.db.entities.Semester
+import kotlinx.coroutines.flow.Flow
+import java.time.LocalDate
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class CompletedLessonsLocal @Inject constructor(private val completedLessonsDb: CompletedLessonsDao) {
+
+ suspend fun saveCompletedLessons(completedLessons: List) {
+ completedLessonsDb.insertAll(completedLessons)
+ }
+
+ suspend fun deleteCompleteLessons(completedLessons: List) {
+ completedLessonsDb.deleteAll(completedLessons)
+ }
+
+ fun getCompletedLessons(semester: Semester, start: LocalDate, end: LocalDate): Flow> {
+ return completedLessonsDb.loadAll(semester.diaryId, semester.studentId, start, end)
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/completedlessons/CompletedLessonsRemote.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/completedlessons/CompletedLessonsRemote.kt
new file mode 100644
index 00000000..d15a2762
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/completedlessons/CompletedLessonsRemote.kt
@@ -0,0 +1,35 @@
+package io.github.wulkanowy.data.repositories.completedlessons
+
+import io.github.wulkanowy.data.db.entities.CompletedLesson
+import io.github.wulkanowy.data.db.entities.Semester
+import io.github.wulkanowy.data.db.entities.Student
+import io.github.wulkanowy.sdk.Sdk
+import io.github.wulkanowy.utils.init
+import java.time.LocalDate
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class CompletedLessonsRemote @Inject constructor(private val sdk: Sdk) {
+
+ suspend fun getCompletedLessons(student: Student, semester: Semester, startDate: LocalDate, endDate: LocalDate): List {
+ return sdk.init(student).switchDiary(semester.diaryId, semester.schoolYear)
+ .getCompletedLessons(startDate, endDate)
+ .map {
+ it.absence
+ CompletedLesson(
+ studentId = semester.studentId,
+ diaryId = semester.diaryId,
+ date = it.date,
+ number = it.number,
+ subject = it.subject,
+ topic = it.topic,
+ teacher = it.teacher,
+ teacherSymbol = it.teacherSymbol,
+ substitution = it.substitution,
+ absence = it.absence,
+ resources = it.resources
+ )
+ }
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/completedlessons/CompletedLessonsRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/completedlessons/CompletedLessonsRepository.kt
new file mode 100644
index 00000000..61268a66
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/completedlessons/CompletedLessonsRepository.kt
@@ -0,0 +1,29 @@
+package io.github.wulkanowy.data.repositories.completedlessons
+
+import io.github.wulkanowy.data.db.entities.Semester
+import io.github.wulkanowy.data.db.entities.Student
+import io.github.wulkanowy.utils.monday
+import io.github.wulkanowy.utils.networkBoundResource
+import io.github.wulkanowy.utils.sunday
+import io.github.wulkanowy.utils.uniqueSubtract
+import java.time.LocalDate
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class CompletedLessonsRepository @Inject constructor(
+ private val local: CompletedLessonsLocal,
+ private val remote: CompletedLessonsRemote
+) {
+
+ fun getCompletedLessons(student: Student, semester: Semester, start: LocalDate, end: LocalDate, forceRefresh: Boolean) = networkBoundResource(
+ shouldFetch = { it.isEmpty() || forceRefresh },
+ query = { local.getCompletedLessons(semester, start.monday, end.sunday) },
+ fetch = { remote.getCompletedLessons(student, semester, start.monday, end.sunday) },
+ saveFetchResult = { old, new ->
+ local.deleteCompleteLessons(old uniqueSubtract new)
+ local.saveCompletedLessons(new uniqueSubtract old)
+ },
+ filterResult = { it.filter { item -> item.date in start..end } }
+ )
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/exam/ExamLocal.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/exam/ExamLocal.kt
new file mode 100644
index 00000000..acc55b5e
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/exam/ExamLocal.kt
@@ -0,0 +1,25 @@
+package io.github.wulkanowy.data.repositories.exam
+
+import io.github.wulkanowy.data.db.dao.ExamDao
+import io.github.wulkanowy.data.db.entities.Exam
+import io.github.wulkanowy.data.db.entities.Semester
+import kotlinx.coroutines.flow.Flow
+import java.time.LocalDate
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class ExamLocal @Inject constructor(private val examDb: ExamDao) {
+
+ fun getExams(semester: Semester, startDate: LocalDate, endDate: LocalDate): Flow> {
+ return examDb.loadAll(semester.diaryId, semester.studentId, startDate, endDate)
+ }
+
+ suspend fun saveExams(exams: List) {
+ examDb.insertAll(exams)
+ }
+
+ suspend fun deleteExams(exams: List) {
+ examDb.deleteAll(exams)
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/exam/ExamRemote.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/exam/ExamRemote.kt
new file mode 100644
index 00000000..ac4aa93d
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/exam/ExamRemote.kt
@@ -0,0 +1,33 @@
+package io.github.wulkanowy.data.repositories.exam
+
+import io.github.wulkanowy.data.db.entities.Exam
+import io.github.wulkanowy.data.db.entities.Semester
+import io.github.wulkanowy.data.db.entities.Student
+import io.github.wulkanowy.sdk.Sdk
+import io.github.wulkanowy.utils.init
+import java.time.LocalDate
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class ExamRemote @Inject constructor(private val sdk: Sdk) {
+
+ suspend fun getExams(student: Student, semester: Semester, startDate: LocalDate, endDate: LocalDate): List {
+ return sdk.init(student).switchDiary(semester.diaryId, semester.schoolYear)
+ .getExams(startDate, endDate, semester.semesterId)
+ .map {
+ Exam(
+ studentId = semester.studentId,
+ diaryId = semester.diaryId,
+ date = it.date,
+ entryDate = it.entryDate,
+ subject = it.subject,
+ group = it.group,
+ type = it.type,
+ description = it.description,
+ teacher = it.teacher,
+ teacherSymbol = it.teacherSymbol
+ )
+ }
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/exam/ExamRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/exam/ExamRepository.kt
new file mode 100644
index 00000000..3f4591a2
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/exam/ExamRepository.kt
@@ -0,0 +1,29 @@
+package io.github.wulkanowy.data.repositories.exam
+
+import io.github.wulkanowy.data.db.entities.Semester
+import io.github.wulkanowy.data.db.entities.Student
+import io.github.wulkanowy.utils.endExamsDay
+import io.github.wulkanowy.utils.networkBoundResource
+import io.github.wulkanowy.utils.startExamsDay
+import io.github.wulkanowy.utils.uniqueSubtract
+import java.time.LocalDate
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class ExamRepository @Inject constructor(
+ private val local: ExamLocal,
+ private val remote: ExamRemote
+) {
+
+ fun getExams(student: Student, semester: Semester, start: LocalDate, end: LocalDate, forceRefresh: Boolean) = networkBoundResource(
+ shouldFetch = { it.isEmpty() || forceRefresh },
+ query = { local.getExams(semester, start.startExamsDay, start.endExamsDay) },
+ fetch = { remote.getExams(student, semester, start.startExamsDay, start.endExamsDay) },
+ saveFetchResult = { old, new ->
+ local.deleteExams(old uniqueSubtract new)
+ local.saveExams(new uniqueSubtract old)
+ },
+ filterResult = { it.filter { item -> item.date in start..end } }
+ )
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/grade/GradeLocal.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/grade/GradeLocal.kt
new file mode 100644
index 00000000..ed363542
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/grade/GradeLocal.kt
@@ -0,0 +1,49 @@
+package io.github.wulkanowy.data.repositories.grade
+
+import io.github.wulkanowy.data.db.dao.GradeDao
+import io.github.wulkanowy.data.db.dao.GradeSummaryDao
+import io.github.wulkanowy.data.db.entities.Grade
+import io.github.wulkanowy.data.db.entities.GradeSummary
+import io.github.wulkanowy.data.db.entities.Semester
+import kotlinx.coroutines.flow.Flow
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class GradeLocal @Inject constructor(
+ private val gradeDb: GradeDao,
+ private val gradeSummaryDb: GradeSummaryDao
+) {
+
+ suspend fun saveGrades(grades: List) {
+ gradeDb.insertAll(grades)
+ }
+
+ suspend fun deleteGrades(grades: List) {
+ gradeDb.deleteAll(grades)
+ }
+
+ suspend fun updateGrades(grades: List) {
+ gradeDb.updateAll(grades)
+ }
+
+ suspend fun updateGradesSummary(gradesSummary: List) {
+ gradeSummaryDb.updateAll(gradesSummary)
+ }
+
+ fun getGradesDetails(semester: Semester): Flow> {
+ return gradeDb.loadAll(semester.semesterId, semester.studentId)
+ }
+
+ suspend fun saveGradesSummary(gradesSummary: List) {
+ gradeSummaryDb.insertAll(gradesSummary)
+ }
+
+ suspend fun deleteGradesSummary(gradesSummary: List) {
+ gradeSummaryDb.deleteAll(gradesSummary)
+ }
+
+ fun getGradesSummary(semester: Semester): Flow> {
+ return gradeSummaryDb.loadAll(semester.semesterId, semester.studentId)
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/grade/GradeRemote.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/grade/GradeRemote.kt
new file mode 100644
index 00000000..9534a891
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/grade/GradeRemote.kt
@@ -0,0 +1,53 @@
+package io.github.wulkanowy.data.repositories.grade
+
+import io.github.wulkanowy.data.db.entities.Grade
+import io.github.wulkanowy.data.db.entities.GradeSummary
+import io.github.wulkanowy.data.db.entities.Semester
+import io.github.wulkanowy.data.db.entities.Student
+import io.github.wulkanowy.sdk.Sdk
+import io.github.wulkanowy.utils.init
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class GradeRemote @Inject constructor(private val sdk: Sdk) {
+
+ suspend fun getGrades(student: Student, semester: Semester): Pair, List> {
+ val (details, summary) = sdk
+ .init(student)
+ .switchDiary(semester.diaryId, semester.schoolYear)
+ .getGrades(semester.semesterId)
+
+ return details.map {
+ Grade(
+ studentId = semester.studentId,
+ semesterId = semester.semesterId,
+ subject = it.subject,
+ entry = it.entry,
+ value = it.value,
+ modifier = it.modifier,
+ comment = it.comment,
+ color = it.color,
+ gradeSymbol = it.symbol,
+ description = it.description,
+ weight = it.weight,
+ weightValue = it.weightValue,
+ date = it.date,
+ teacher = it.teacher
+ )
+ } to summary.map {
+ GradeSummary(
+ semesterId = semester.semesterId,
+ studentId = semester.studentId,
+ position = 0,
+ subject = it.name,
+ predictedGrade = it.predicted,
+ finalGrade = it.final,
+ pointsSum = it.pointsSum,
+ proposedPoints = it.proposedPoints,
+ finalPoints = it.finalPoints,
+ average = it.average
+ )
+ }
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/GradeRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/grade/GradeRepository.kt
similarity index 54%
rename from app/src/main/java/io/github/wulkanowy/data/repositories/GradeRepository.kt
rename to app/src/main/java/io/github/wulkanowy/data/repositories/grade/GradeRepository.kt
index bab290f3..8cbbfdfb 100644
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/GradeRepository.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/grade/GradeRepository.kt
@@ -1,16 +1,9 @@
-package io.github.wulkanowy.data.repositories
+package io.github.wulkanowy.data.repositories.grade
-import io.github.wulkanowy.data.db.dao.GradeDao
-import io.github.wulkanowy.data.db.dao.GradeSummaryDao
import io.github.wulkanowy.data.db.entities.Grade
import io.github.wulkanowy.data.db.entities.GradeSummary
import io.github.wulkanowy.data.db.entities.Semester
import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.data.mappers.mapToEntities
-import io.github.wulkanowy.sdk.Sdk
-import io.github.wulkanowy.utils.AutoRefreshHelper
-import io.github.wulkanowy.utils.getRefreshKey
-import io.github.wulkanowy.utils.init
import io.github.wulkanowy.utils.networkBoundResource
import io.github.wulkanowy.utils.uniqueSubtract
import kotlinx.coroutines.flow.Flow
@@ -22,40 +15,24 @@ import javax.inject.Singleton
@Singleton
class GradeRepository @Inject constructor(
- private val gradeDb: GradeDao,
- private val gradeSummaryDb: GradeSummaryDao,
- private val sdk: Sdk,
- private val refreshHelper: AutoRefreshHelper,
+ private val local: GradeLocal,
+ private val remote: GradeRemote
) {
- private val cacheKey = "grade"
-
fun getGrades(student: Student, semester: Semester, forceRefresh: Boolean, notify: Boolean = false) = networkBoundResource(
- shouldFetch = { (details, summaries) -> details.isEmpty() || summaries.isEmpty() || forceRefresh || refreshHelper.isShouldBeRefreshed(getRefreshKey(cacheKey, semester)) },
- query = {
- gradeDb.loadAll(semester.semesterId, semester.studentId).combine(gradeSummaryDb.loadAll(semester.semesterId, semester.studentId)) { details, summaries ->
- details to summaries
- }
- },
- fetch = {
- val (details, summary) = sdk.init(student)
- .switchDiary(semester.diaryId, semester.schoolYear)
- .getGrades(semester.semesterId)
-
- details.mapToEntities(semester) to summary.mapToEntities(semester)
- },
- saveFetchResult = { (oldDetails, oldSummary), (newDetails, newSummary) ->
- refreshGradeDetails(student, oldDetails, newDetails, notify)
- refreshGradeSummaries(oldSummary, newSummary, notify)
-
- refreshHelper.updateLastRefreshTimestamp(getRefreshKey(cacheKey, semester))
+ shouldFetch = { (details, summaries) -> details.isEmpty() || summaries.isEmpty() || forceRefresh },
+ query = { local.getGradesDetails(semester).combine(local.getGradesSummary(semester)) { details, summaries -> details to summaries } },
+ fetch = { remote.getGrades(student, semester) },
+ saveFetchResult = { old, new ->
+ refreshGradeDetails(student, old.first, new.first, notify)
+ refreshGradeSummaries(old.second, new.second, notify)
}
)
private suspend fun refreshGradeDetails(student: Student, oldGrades: List, newDetails: List, notify: Boolean) {
val notifyBreakDate = oldGrades.maxByOrNull { it.date }?.date ?: student.registrationDate.toLocalDate()
- gradeDb.deleteAll(oldGrades uniqueSubtract newDetails)
- gradeDb.insertAll((newDetails uniqueSubtract oldGrades).onEach {
+ local.deleteGrades(oldGrades uniqueSubtract newDetails)
+ local.saveGrades((newDetails uniqueSubtract oldGrades).onEach {
if (it.date >= notifyBreakDate) it.apply {
isRead = false
if (notify) isNotified = false
@@ -64,8 +41,8 @@ class GradeRepository @Inject constructor(
}
private suspend fun refreshGradeSummaries(oldSummaries: List, newSummary: List, notify: Boolean) {
- gradeSummaryDb.deleteAll(oldSummaries uniqueSubtract newSummary)
- gradeSummaryDb.insertAll((newSummary uniqueSubtract oldSummaries).onEach { summary ->
+ local.deleteGradesSummary(oldSummaries uniqueSubtract newSummary)
+ local.saveGradesSummary((newSummary uniqueSubtract oldSummaries).onEach { summary ->
val oldSummary = oldSummaries.find { oldSummary -> oldSummary.subject == summary.subject }
summary.isPredictedGradeNotified = when {
summary.predictedGrade.isEmpty() -> true
@@ -92,30 +69,30 @@ class GradeRepository @Inject constructor(
}
fun getUnreadGrades(semester: Semester): Flow> {
- return gradeDb.loadAll(semester.semesterId, semester.studentId).map { it.filter { grade -> !grade.isRead } }
+ return local.getGradesDetails(semester).map { it.filter { grade -> !grade.isRead } }
}
fun getNotNotifiedGrades(semester: Semester): Flow> {
- return gradeDb.loadAll(semester.semesterId, semester.studentId).map { it.filter { grade -> !grade.isNotified } }
+ return local.getGradesDetails(semester).map { it.filter { grade -> !grade.isNotified } }
}
fun getNotNotifiedPredictedGrades(semester: Semester): Flow> {
- return gradeSummaryDb.loadAll(semester.semesterId, semester.studentId).map { it.filter { gradeSummary -> !gradeSummary.isPredictedGradeNotified } }
+ return local.getGradesSummary(semester).map { it.filter { gradeSummary -> !gradeSummary.isPredictedGradeNotified } }
}
fun getNotNotifiedFinalGrades(semester: Semester): Flow> {
- return gradeSummaryDb.loadAll(semester.semesterId, semester.studentId).map { it.filter { gradeSummary -> !gradeSummary.isFinalGradeNotified } }
+ return local.getGradesSummary(semester).map { it.filter { gradeSummary -> !gradeSummary.isFinalGradeNotified } }
}
suspend fun updateGrade(grade: Grade) {
- return gradeDb.updateAll(listOf(grade))
+ return local.updateGrades(listOf(grade))
}
suspend fun updateGrades(grades: List) {
- return gradeDb.updateAll(grades)
+ return local.updateGrades(grades)
}
suspend fun updateGradesSummary(gradesSummary: List) {
- return gradeSummaryDb.updateAll(gradesSummary)
+ return local.updateGradesSummary(gradesSummary)
}
}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/gradestatistics/GradeStatisticsLocal.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/gradestatistics/GradeStatisticsLocal.kt
new file mode 100644
index 00000000..e0e2cd4d
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/gradestatistics/GradeStatisticsLocal.kt
@@ -0,0 +1,41 @@
+package io.github.wulkanowy.data.repositories.gradestatistics
+
+import io.github.wulkanowy.data.db.dao.GradePointsStatisticsDao
+import io.github.wulkanowy.data.db.dao.GradeStatisticsDao
+import io.github.wulkanowy.data.db.entities.GradePointsStatistics
+import io.github.wulkanowy.data.db.entities.GradeStatistics
+import io.github.wulkanowy.data.db.entities.Semester
+import kotlinx.coroutines.flow.Flow
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class GradeStatisticsLocal @Inject constructor(
+ private val gradeStatisticsDb: GradeStatisticsDao,
+ private val gradePointsStatisticsDb: GradePointsStatisticsDao
+) {
+
+ fun getGradesStatistics(semester: Semester, isSemester: Boolean): Flow> {
+ return gradeStatisticsDb.loadAll(semester.semesterId, semester.studentId, isSemester)
+ }
+
+ fun getGradesPointsStatistics(semester: Semester): Flow> {
+ return gradePointsStatisticsDb.loadAll(semester.semesterId, semester.studentId)
+ }
+
+ suspend fun saveGradesStatistics(gradesStatistics: List) {
+ gradeStatisticsDb.insertAll(gradesStatistics)
+ }
+
+ suspend fun saveGradesPointsStatistics(gradePointsStatistics: List) {
+ gradePointsStatisticsDb.insertAll(gradePointsStatistics)
+ }
+
+ suspend fun deleteGradesStatistics(gradesStatistics: List) {
+ gradeStatisticsDb.deleteAll(gradesStatistics)
+ }
+
+ suspend fun deleteGradesPointsStatistics(gradesPointsStatistics: List) {
+ gradePointsStatisticsDb.deleteAll(gradesPointsStatistics)
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/gradestatistics/GradeStatisticsRemote.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/gradestatistics/GradeStatisticsRemote.kt
new file mode 100644
index 00000000..1ff8132f
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/gradestatistics/GradeStatisticsRemote.kt
@@ -0,0 +1,44 @@
+package io.github.wulkanowy.data.repositories.gradestatistics
+
+import io.github.wulkanowy.data.db.entities.GradePointsStatistics
+import io.github.wulkanowy.data.db.entities.GradeStatistics
+import io.github.wulkanowy.data.db.entities.Semester
+import io.github.wulkanowy.data.db.entities.Student
+import io.github.wulkanowy.sdk.Sdk
+import io.github.wulkanowy.utils.init
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class GradeStatisticsRemote @Inject constructor(private val sdk: Sdk) {
+
+ suspend fun getGradeStatistics(student: Student, semester: Semester, isSemester: Boolean): List {
+ return sdk.init(student).switchDiary(semester.diaryId, semester.schoolYear).let {
+ if (isSemester) it.getGradesAnnualStatistics(semester.semesterId)
+ else it.getGradesPartialStatistics(semester.semesterId)
+ }.map {
+ GradeStatistics(
+ semesterId = semester.semesterId,
+ studentId = semester.studentId,
+ subject = it.subject,
+ grade = it.gradeValue,
+ amount = it.amount,
+ semester = isSemester
+ )
+ }
+ }
+
+ suspend fun getGradePointsStatistics(student: Student, semester: Semester): List {
+ return sdk.init(student).switchDiary(semester.diaryId, semester.schoolYear)
+ .getGradesPointsStatistics(semester.semesterId)
+ .map {
+ GradePointsStatistics(
+ semesterId = semester.semesterId,
+ studentId = semester.studentId,
+ subject = it.subject,
+ others = it.others,
+ student = it.student
+ )
+ }
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/gradestatistics/GradeStatisticsRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/gradestatistics/GradeStatisticsRepository.kt
new file mode 100644
index 00000000..52ca705f
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/gradestatistics/GradeStatisticsRepository.kt
@@ -0,0 +1,72 @@
+package io.github.wulkanowy.data.repositories.gradestatistics
+
+import io.github.wulkanowy.data.db.entities.GradePointsStatistics
+import io.github.wulkanowy.data.db.entities.GradeStatistics
+import io.github.wulkanowy.data.db.entities.Semester
+import io.github.wulkanowy.data.db.entities.Student
+import io.github.wulkanowy.data.pojos.GradeStatisticsItem
+import io.github.wulkanowy.ui.modules.grade.statistics.ViewType
+import io.github.wulkanowy.utils.networkBoundResource
+import io.github.wulkanowy.utils.uniqueSubtract
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class GradeStatisticsRepository @Inject constructor(
+ private val local: GradeStatisticsLocal,
+ private val remote: GradeStatisticsRemote
+) {
+
+ fun getGradesStatistics(student: Student, semester: Semester, subjectName: String, isSemester: Boolean, forceRefresh: Boolean) = networkBoundResource(
+ shouldFetch = { it.isEmpty() || forceRefresh },
+ query = { local.getGradesStatistics(semester, isSemester) },
+ fetch = { remote.getGradeStatistics(student, semester, isSemester) },
+ saveFetchResult = { old, new ->
+ local.deleteGradesStatistics(old uniqueSubtract new)
+ local.saveGradesStatistics(new uniqueSubtract old)
+ },
+ mapResult = { items ->
+ when (subjectName) {
+ "Wszystkie" -> items.groupBy { it.grade }.map {
+ GradeStatistics(semester.studentId, semester.semesterId, subjectName, it.key,
+ it.value.fold(0) { acc, e -> acc + e.amount }, false)
+ } + items
+ else -> items.filter { it.subject == subjectName }
+ }.mapToStatisticItems()
+ }
+ )
+
+ fun getGradesPointsStatistics(student: Student, semester: Semester, subjectName: String, forceRefresh: Boolean) = networkBoundResource(
+ shouldFetch = { it.isEmpty() || forceRefresh },
+ query = { local.getGradesPointsStatistics(semester) },
+ fetch = { remote.getGradePointsStatistics(student, semester) },
+ saveFetchResult = { old, new ->
+ local.deleteGradesPointsStatistics(old uniqueSubtract new)
+ local.saveGradesPointsStatistics(new uniqueSubtract old)
+ },
+ mapResult = { items ->
+ when (subjectName) {
+ "Wszystkie" -> items
+ else -> items.filter { it.subject == subjectName }
+ }.mapToStatisticsItem()
+ }
+ )
+
+ private fun List.mapToStatisticItems() = groupBy { it.subject }.map {
+ GradeStatisticsItem(
+ type = ViewType.PARTIAL,
+ partial = it.value
+ .sortedByDescending { item -> item.grade }
+ .filter { item -> item.amount != 0 },
+ points = null
+ )
+ }
+
+ private fun List.mapToStatisticsItem() = map {
+ GradeStatisticsItem(
+ type = ViewType.POINTS,
+ partial = emptyList(),
+ points = it
+ )
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/homework/HomeworkLocal.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/homework/HomeworkLocal.kt
new file mode 100644
index 00000000..f2cbb803
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/homework/HomeworkLocal.kt
@@ -0,0 +1,29 @@
+package io.github.wulkanowy.data.repositories.homework
+
+import io.github.wulkanowy.data.db.dao.HomeworkDao
+import io.github.wulkanowy.data.db.entities.Homework
+import io.github.wulkanowy.data.db.entities.Semester
+import kotlinx.coroutines.flow.Flow
+import java.time.LocalDate
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class HomeworkLocal @Inject constructor(private val homeworkDb: HomeworkDao) {
+
+ suspend fun saveHomework(homework: List) {
+ homeworkDb.insertAll(homework)
+ }
+
+ suspend fun deleteHomework(homework: List) {
+ homeworkDb.deleteAll(homework)
+ }
+
+ suspend fun updateHomework(homework: List) {
+ homeworkDb.updateAll(homework)
+ }
+
+ fun getHomework(semester: Semester, startDate: LocalDate, endDate: LocalDate): Flow> {
+ return homeworkDb.loadAll(semester.semesterId, semester.studentId, startDate, endDate)
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/homework/HomeworkRemote.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/homework/HomeworkRemote.kt
new file mode 100644
index 00000000..32109877
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/homework/HomeworkRemote.kt
@@ -0,0 +1,32 @@
+package io.github.wulkanowy.data.repositories.homework
+
+import io.github.wulkanowy.data.db.entities.Homework
+import io.github.wulkanowy.data.db.entities.Semester
+import io.github.wulkanowy.data.db.entities.Student
+import io.github.wulkanowy.sdk.Sdk
+import io.github.wulkanowy.utils.init
+import java.time.LocalDate
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class HomeworkRemote @Inject constructor(private val sdk: Sdk) {
+
+ suspend fun getHomework(student: Student, semester: Semester, startDate: LocalDate, endDate: LocalDate): List {
+ return sdk.init(student).switchDiary(semester.diaryId, semester.schoolYear)
+ .getHomework(startDate, endDate)
+ .map {
+ Homework(
+ semesterId = semester.semesterId,
+ studentId = semester.studentId,
+ date = it.date,
+ entryDate = it.entryDate,
+ subject = it.subject,
+ content = it.content,
+ teacher = it.teacher,
+ teacherSymbol = it.teacherSymbol,
+ attachments = it.attachments.map { attachment -> attachment.url to attachment.name }
+ )
+ }
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/homework/HomeworkRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/homework/HomeworkRepository.kt
new file mode 100644
index 00000000..54397ea0
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/homework/HomeworkRepository.kt
@@ -0,0 +1,35 @@
+package io.github.wulkanowy.data.repositories.homework
+
+import io.github.wulkanowy.data.db.entities.Homework
+import io.github.wulkanowy.data.db.entities.Semester
+import io.github.wulkanowy.data.db.entities.Student
+import io.github.wulkanowy.utils.monday
+import io.github.wulkanowy.utils.networkBoundResource
+import io.github.wulkanowy.utils.sunday
+import io.github.wulkanowy.utils.uniqueSubtract
+import java.time.LocalDate
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class HomeworkRepository @Inject constructor(
+ private val local: HomeworkLocal,
+ private val remote: HomeworkRemote
+) {
+
+ fun getHomework(student: Student, semester: Semester, start: LocalDate, end: LocalDate, forceRefresh: Boolean) = networkBoundResource(
+ shouldFetch = { it.isEmpty() || forceRefresh },
+ query = { local.getHomework(semester, start.monday, end.sunday) },
+ fetch = { remote.getHomework(student, semester, start.monday, end.sunday) },
+ saveFetchResult = { old, new ->
+ local.deleteHomework(old uniqueSubtract new)
+ local.saveHomework(new uniqueSubtract old)
+ }
+ )
+
+ suspend fun toggleDone(homework: Homework) {
+ local.updateHomework(listOf(homework.apply {
+ isDone = !isDone
+ }))
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/LoggerRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/logger/LoggerRepository.kt
similarity index 96%
rename from app/src/main/java/io/github/wulkanowy/data/repositories/LoggerRepository.kt
rename to app/src/main/java/io/github/wulkanowy/data/repositories/logger/LoggerRepository.kt
index 6d509b02..85168fee 100644
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/LoggerRepository.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/logger/LoggerRepository.kt
@@ -1,4 +1,4 @@
-package io.github.wulkanowy.data.repositories
+package io.github.wulkanowy.data.repositories.logger
import android.content.Context
import dagger.hilt.android.qualifiers.ApplicationContext
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/luckynumber/LuckyNumberLocal.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/luckynumber/LuckyNumberLocal.kt
new file mode 100644
index 00000000..0c3156d1
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/luckynumber/LuckyNumberLocal.kt
@@ -0,0 +1,29 @@
+package io.github.wulkanowy.data.repositories.luckynumber
+
+import io.github.wulkanowy.data.db.dao.LuckyNumberDao
+import io.github.wulkanowy.data.db.entities.LuckyNumber
+import io.github.wulkanowy.data.db.entities.Student
+import kotlinx.coroutines.flow.Flow
+import java.time.LocalDate
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class LuckyNumberLocal @Inject constructor(private val luckyNumberDb: LuckyNumberDao) {
+
+ suspend fun saveLuckyNumber(luckyNumber: LuckyNumber?) {
+ luckyNumberDb.insertAll(listOfNotNull(luckyNumber))
+ }
+
+ suspend fun updateLuckyNumber(luckyNumber: LuckyNumber?) {
+ luckyNumberDb.updateAll(listOfNotNull(luckyNumber))
+ }
+
+ suspend fun deleteLuckyNumber(luckyNumber: LuckyNumber?) {
+ luckyNumberDb.deleteAll(listOfNotNull(luckyNumber))
+ }
+
+ fun getLuckyNumber(student: Student, date: LocalDate): Flow {
+ return luckyNumberDb.load(student.studentId, date)
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/luckynumber/LuckyNumberRemote.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/luckynumber/LuckyNumberRemote.kt
new file mode 100644
index 00000000..2872957d
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/luckynumber/LuckyNumberRemote.kt
@@ -0,0 +1,23 @@
+package io.github.wulkanowy.data.repositories.luckynumber
+
+import io.github.wulkanowy.data.db.entities.LuckyNumber
+import io.github.wulkanowy.data.db.entities.Student
+import io.github.wulkanowy.sdk.Sdk
+import io.github.wulkanowy.utils.init
+import java.time.LocalDate
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class LuckyNumberRemote @Inject constructor(private val sdk: Sdk) {
+
+ suspend fun getLuckyNumber(student: Student): LuckyNumber? {
+ return sdk.init(student).getLuckyNumber(student.schoolShortName)?.let {
+ LuckyNumber(
+ studentId = student.studentId,
+ date = LocalDate.now(),
+ luckyNumber = it
+ )
+ }
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/luckynumber/LuckyNumberRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/luckynumber/LuckyNumberRepository.kt
new file mode 100644
index 00000000..173ce7e4
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/luckynumber/LuckyNumberRepository.kt
@@ -0,0 +1,36 @@
+package io.github.wulkanowy.data.repositories.luckynumber
+
+import io.github.wulkanowy.data.db.entities.LuckyNumber
+import io.github.wulkanowy.data.db.entities.Student
+import io.github.wulkanowy.utils.networkBoundResource
+import kotlinx.coroutines.flow.first
+import kotlinx.coroutines.flow.map
+import java.time.LocalDate.now
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class LuckyNumberRepository @Inject constructor(
+ private val local: LuckyNumberLocal,
+ private val remote: LuckyNumberRemote
+) {
+
+ fun getLuckyNumber(student: Student, forceRefresh: Boolean, notify: Boolean = false) = networkBoundResource(
+ shouldFetch = { it == null || forceRefresh },
+ query = { local.getLuckyNumber(student, now()) },
+ fetch = { remote.getLuckyNumber(student) },
+ saveFetchResult = { old, new ->
+ if (new != old) {
+ old?.let { local.deleteLuckyNumber(it) }
+ local.saveLuckyNumber(new?.apply {
+ if (notify) isNotified = false
+ })
+ }
+ }
+ )
+
+ suspend fun getNotNotifiedLuckyNumber(student: Student) =
+ local.getLuckyNumber(student, now()).map { if (it?.isNotified == false) it else null }.first()
+
+ suspend fun updateLuckyNumber(luckyNumber: LuckyNumber?) = local.updateLuckyNumber(luckyNumber)
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/enums/MessageFolder.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/message/MessageFolder.kt
similarity index 63%
rename from app/src/main/java/io/github/wulkanowy/data/enums/MessageFolder.kt
rename to app/src/main/java/io/github/wulkanowy/data/repositories/message/MessageFolder.kt
index 899ba908..06f5a1e0 100644
--- a/app/src/main/java/io/github/wulkanowy/data/enums/MessageFolder.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/message/MessageFolder.kt
@@ -1,4 +1,4 @@
-package io.github.wulkanowy.data.enums
+package io.github.wulkanowy.data.repositories.message
enum class MessageFolder(val id: Int = 1) {
RECEIVED(1),
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/message/MessageLocal.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/message/MessageLocal.kt
new file mode 100644
index 00000000..f1c8eaf0
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/message/MessageLocal.kt
@@ -0,0 +1,42 @@
+package io.github.wulkanowy.data.repositories.message
+
+import io.github.wulkanowy.data.db.dao.MessageAttachmentDao
+import io.github.wulkanowy.data.db.dao.MessagesDao
+import io.github.wulkanowy.data.db.entities.Message
+import io.github.wulkanowy.data.db.entities.MessageAttachment
+import io.github.wulkanowy.data.db.entities.MessageWithAttachment
+import io.github.wulkanowy.data.db.entities.Student
+import kotlinx.coroutines.flow.Flow
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class MessageLocal @Inject constructor(
+ private val messagesDb: MessagesDao,
+ private val messageAttachmentDao: MessageAttachmentDao
+) {
+
+ suspend fun saveMessages(messages: List) {
+ messagesDb.insertAll(messages)
+ }
+
+ suspend fun updateMessages(messages: List) {
+ messagesDb.updateAll(messages)
+ }
+
+ suspend fun deleteMessages(messages: List) {
+ messagesDb.deleteAll(messages)
+ }
+
+ fun getMessageWithAttachment(student: Student, message: Message): Flow {
+ return messagesDb.loadMessageWithAttachment(student.id.toInt(), message.messageId)
+ }
+
+ suspend fun saveMessageAttachments(attachments: List) {
+ messageAttachmentDao.insertAttachments(attachments)
+ }
+
+ fun getMessages(student: Student, folder: MessageFolder): Flow> {
+ return messagesDb.loadAll(student.id.toInt(), folder.id)
+ }
+}
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
new file mode 100644
index 00000000..044a13a2
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/message/MessageRemote.kt
@@ -0,0 +1,78 @@
+package io.github.wulkanowy.data.repositories.message
+
+import io.github.wulkanowy.data.db.entities.Message
+import io.github.wulkanowy.data.db.entities.MessageAttachment
+import io.github.wulkanowy.data.db.entities.Recipient
+import io.github.wulkanowy.data.db.entities.Semester
+import io.github.wulkanowy.data.db.entities.Student
+import io.github.wulkanowy.sdk.Sdk
+import io.github.wulkanowy.sdk.pojo.Folder
+import io.github.wulkanowy.sdk.pojo.SentMessage
+import io.github.wulkanowy.utils.init
+import java.time.LocalDateTime.now
+import javax.inject.Inject
+import javax.inject.Singleton
+import io.github.wulkanowy.sdk.pojo.Recipient as SdkRecipient
+
+@Singleton
+class MessageRemote @Inject constructor(private val sdk: Sdk) {
+
+ suspend fun getMessages(student: Student, semester: Semester, folder: MessageFolder): List {
+ return sdk.init(student).getMessages(Folder.valueOf(folder.name), now().minusMonths(3), now()).map {
+ Message(
+ studentId = student.id.toInt(),
+ realId = it.id ?: 0,
+ messageId = it.messageId ?: 0,
+ sender = it.sender?.name.orEmpty(),
+ senderId = it.sender?.loginId ?: 0,
+ recipient = it.recipients.singleOrNull()?.name ?: "Wielu adresatów",
+ subject = it.subject.trim(),
+ date = it.date ?: now(),
+ folderId = it.folderId,
+ unread = it.unread ?: false,
+ removed = it.removed,
+ hasAttachments = it.hasAttachments
+ ).apply {
+ content = it.content.orEmpty()
+ unreadBy = it.unreadBy ?: 0
+ readBy = it.readBy ?: 0
+ }
+ }
+ }
+
+ suspend fun getMessagesContentDetails(student: Student, message: Message, markAsRead: Boolean = false): Pair> {
+ return sdk.init(student).getMessageDetails(message.messageId, message.folderId, markAsRead, message.realId).let { details ->
+ details.content to details.attachments.map {
+ MessageAttachment(
+ realId = it.id,
+ messageId = it.messageId,
+ oneDriveId = it.oneDriveId,
+ url = it.url,
+ filename = it.filename
+ )
+ }
+ }
+ }
+
+ suspend fun sendMessage(student: Student, subject: String, content: String, recipients: List): SentMessage {
+ return sdk.init(student).sendMessage(
+ subject = subject,
+ content = content,
+ recipients = recipients.map {
+ SdkRecipient(
+ id = it.realId,
+ name = it.realName,
+ loginId = it.loginId,
+ reportingUnitId = it.unitId,
+ role = it.role,
+ hash = it.hash,
+ shortName = it.name
+ )
+ }
+ )
+ }
+
+ suspend fun deleteMessage(student: Student, message: Message): Boolean {
+ return sdk.init(student).deleteMessages(listOf(message.messageId), message.folderId)
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/message/MessageRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/message/MessageRepository.kt
new file mode 100644
index 00000000..bb932699
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/message/MessageRepository.kt
@@ -0,0 +1,76 @@
+package io.github.wulkanowy.data.repositories.message
+
+import io.github.wulkanowy.data.db.entities.Message
+import io.github.wulkanowy.data.db.entities.Recipient
+import io.github.wulkanowy.data.db.entities.Semester
+import io.github.wulkanowy.data.db.entities.Student
+import io.github.wulkanowy.data.repositories.message.MessageFolder.RECEIVED
+import io.github.wulkanowy.sdk.pojo.SentMessage
+import io.github.wulkanowy.utils.networkBoundResource
+import io.github.wulkanowy.utils.uniqueSubtract
+import kotlinx.coroutines.flow.Flow
+import kotlinx.coroutines.flow.map
+import timber.log.Timber
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class MessageRepository @Inject constructor(
+ private val local: MessageLocal,
+ private val remote: MessageRemote
+) {
+
+ fun getMessages(student: Student, semester: Semester, folder: MessageFolder, forceRefresh: Boolean, notify: Boolean = false) = networkBoundResource(
+ shouldFetch = { it.isEmpty() || forceRefresh },
+ query = { local.getMessages(student, folder) },
+ fetch = { remote.getMessages(student, semester, folder) },
+ saveFetchResult = { old, new ->
+ local.deleteMessages(old uniqueSubtract new)
+ local.saveMessages((new uniqueSubtract old).onEach {
+ it.isNotified = !notify
+ })
+ }
+ )
+
+ fun getMessage(student: Student, message: Message, markAsRead: Boolean = false) = networkBoundResource(
+ shouldFetch = {
+ checkNotNull(it, { "This message no longer exist!" })
+ Timber.d("Message content in db empty: ${it.message.content.isEmpty()}")
+ it.message.unread || it.message.content.isEmpty()
+ },
+ query = { local.getMessageWithAttachment(student, message) },
+ fetch = { remote.getMessagesContentDetails(student, it!!.message, markAsRead) },
+ saveFetchResult = { old, (downloadedMessage, attachments) ->
+ checkNotNull(old, { "Fetched message no longer exist!" })
+ local.updateMessages(listOf(old.message.copy(unread = !markAsRead).apply {
+ id = old.message.id
+ content = content.ifBlank { downloadedMessage }
+ }))
+ local.saveMessageAttachments(attachments)
+ Timber.d("Message ${message.messageId} with blank content: ${old.message.content.isBlank()}, marked as read")
+ }
+ )
+
+ fun getNotNotifiedMessages(student: Student): Flow> {
+ return local.getMessages(student, RECEIVED).map { it.filter { message -> !message.isNotified && message.unread } }
+ }
+
+ suspend fun updateMessages(messages: List) {
+ return local.updateMessages(messages)
+ }
+
+ suspend fun sendMessage(student: Student, subject: String, content: String, recipients: List): SentMessage {
+ return remote.sendMessage(student, subject, content, recipients)
+ }
+
+ suspend fun deleteMessage(student: Student, message: Message) {
+ val isDeleted = remote.deleteMessage(student, message)
+
+ if (message.folderId != MessageFolder.TRASHED.id) {
+ if (isDeleted) local.updateMessages(listOf(message.copy(folderId = MessageFolder.TRASHED.id).apply {
+ id = message.id
+ content = message.content
+ }))
+ } else local.deleteMessages(listOf(message))
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/mobiledevice/MobileDeviceLocal.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/mobiledevice/MobileDeviceLocal.kt
new file mode 100644
index 00000000..0ccb3d7e
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/mobiledevice/MobileDeviceLocal.kt
@@ -0,0 +1,24 @@
+package io.github.wulkanowy.data.repositories.mobiledevice
+
+import io.github.wulkanowy.data.db.dao.MobileDeviceDao
+import io.github.wulkanowy.data.db.entities.MobileDevice
+import io.github.wulkanowy.data.db.entities.Semester
+import kotlinx.coroutines.flow.Flow
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class MobileDeviceLocal @Inject constructor(private val mobileDb: MobileDeviceDao) {
+
+ suspend fun saveDevices(devices: List) {
+ mobileDb.insertAll(devices)
+ }
+
+ suspend fun deleteDevices(devices: List) {
+ mobileDb.deleteAll(devices)
+ }
+
+ fun getDevices(semester: Semester): Flow> {
+ return mobileDb.loadAll(semester.studentId)
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/mobiledevice/MobileDeviceRemote.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/mobiledevice/MobileDeviceRemote.kt
new file mode 100644
index 00000000..907e965c
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/mobiledevice/MobileDeviceRemote.kt
@@ -0,0 +1,45 @@
+package io.github.wulkanowy.data.repositories.mobiledevice
+
+import io.github.wulkanowy.data.db.entities.MobileDevice
+import io.github.wulkanowy.data.db.entities.Semester
+import io.github.wulkanowy.data.db.entities.Student
+import io.github.wulkanowy.data.pojos.MobileDeviceToken
+import io.github.wulkanowy.sdk.Sdk
+import io.github.wulkanowy.utils.init
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class MobileDeviceRemote @Inject constructor(private val sdk: Sdk) {
+
+ suspend fun getDevices(student: Student, semester: Semester): List {
+ return sdk.init(student).switchDiary(semester.diaryId, semester.schoolYear)
+ .getRegisteredDevices()
+ .map {
+ MobileDevice(
+ studentId = semester.studentId,
+ date = it.createDate,
+ deviceId = it.id,
+ name = it.name
+ )
+ }
+ }
+
+ suspend fun unregisterDevice(student: Student, semester: Semester, device: MobileDevice): Boolean {
+ return sdk.init(student).switchDiary(semester.diaryId, semester.schoolYear)
+ .unregisterDevice(device.deviceId)
+ }
+
+ suspend fun getToken(student: Student, semester: Semester): MobileDeviceToken {
+ return sdk.init(student).switchDiary(semester.diaryId, semester.schoolYear)
+ .getToken()
+ .let {
+ MobileDeviceToken(
+ token = it.token,
+ symbol = it.symbol,
+ pin = it.pin,
+ qr = it.qrCodeImage
+ )
+ }
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/mobiledevice/MobileDeviceRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/mobiledevice/MobileDeviceRepository.kt
new file mode 100644
index 00000000..65526ef8
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/mobiledevice/MobileDeviceRepository.kt
@@ -0,0 +1,36 @@
+package io.github.wulkanowy.data.repositories.mobiledevice
+
+import io.github.wulkanowy.data.db.entities.MobileDevice
+import io.github.wulkanowy.data.db.entities.Semester
+import io.github.wulkanowy.data.db.entities.Student
+import io.github.wulkanowy.data.pojos.MobileDeviceToken
+import io.github.wulkanowy.utils.networkBoundResource
+import io.github.wulkanowy.utils.uniqueSubtract
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class MobileDeviceRepository @Inject constructor(
+ private val local: MobileDeviceLocal,
+ private val remote: MobileDeviceRemote
+) {
+
+ fun getDevices(student: Student, semester: Semester, forceRefresh: Boolean) = networkBoundResource(
+ shouldFetch = { it.isEmpty() || forceRefresh },
+ query = { local.getDevices(semester) },
+ fetch = { remote.getDevices(student, semester) },
+ saveFetchResult = { old, new ->
+ local.deleteDevices(old uniqueSubtract new)
+ local.saveDevices(new uniqueSubtract old)
+ }
+ )
+
+ suspend fun unregisterDevice(student: Student, semester: Semester, device: MobileDevice) {
+ remote.unregisterDevice(student, semester, device)
+ local.deleteDevices(listOf(device))
+ }
+
+ suspend fun getToken(student: Student, semester: Semester): MobileDeviceToken {
+ return remote.getToken(student, semester)
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/note/NoteLocal.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/note/NoteLocal.kt
new file mode 100644
index 00000000..85ba5e22
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/note/NoteLocal.kt
@@ -0,0 +1,28 @@
+package io.github.wulkanowy.data.repositories.note
+
+import io.github.wulkanowy.data.db.dao.NoteDao
+import io.github.wulkanowy.data.db.entities.Note
+import io.github.wulkanowy.data.db.entities.Student
+import kotlinx.coroutines.flow.Flow
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class NoteLocal @Inject constructor(private val noteDb: NoteDao) {
+
+ suspend fun saveNotes(notes: List) {
+ noteDb.insertAll(notes)
+ }
+
+ suspend fun updateNotes(notes: List) {
+ noteDb.updateAll(notes)
+ }
+
+ suspend fun deleteNotes(notes: List) {
+ noteDb.deleteAll(notes)
+ }
+
+ fun getNotes(student: Student): Flow> {
+ return noteDb.loadAll(student.studentId)
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/note/NoteRemote.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/note/NoteRemote.kt
new file mode 100644
index 00000000..0e488b7d
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/note/NoteRemote.kt
@@ -0,0 +1,31 @@
+package io.github.wulkanowy.data.repositories.note
+
+import io.github.wulkanowy.data.db.entities.Note
+import io.github.wulkanowy.data.db.entities.Semester
+import io.github.wulkanowy.data.db.entities.Student
+import io.github.wulkanowy.sdk.Sdk
+import io.github.wulkanowy.utils.init
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class NoteRemote @Inject constructor(private val sdk: Sdk) {
+
+ suspend fun getNotes(student: Student, semester: Semester): List {
+ return sdk.init(student).switchDiary(semester.diaryId, semester.schoolYear)
+ .getNotes(semester.semesterId)
+ .map {
+ Note(
+ studentId = semester.studentId,
+ date = it.date,
+ teacher = it.teacher,
+ teacherSymbol = it.teacherSymbol,
+ category = it.category,
+ categoryType = it.categoryType.id,
+ isPointsShow = it.showPoints,
+ points = it.points,
+ content = it.content
+ )
+ }
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/note/NoteRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/note/NoteRepository.kt
new file mode 100644
index 00000000..6cf62ba2
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/note/NoteRepository.kt
@@ -0,0 +1,45 @@
+package io.github.wulkanowy.data.repositories.note
+
+import io.github.wulkanowy.data.db.entities.Note
+import io.github.wulkanowy.data.db.entities.Semester
+import io.github.wulkanowy.data.db.entities.Student
+import io.github.wulkanowy.utils.networkBoundResource
+import io.github.wulkanowy.utils.uniqueSubtract
+import kotlinx.coroutines.flow.Flow
+import kotlinx.coroutines.flow.map
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class NoteRepository @Inject constructor(
+ private val local: NoteLocal,
+ private val remote: NoteRemote
+) {
+
+ fun getNotes(student: Student, semester: Semester, forceRefresh: Boolean, notify: Boolean = false) = networkBoundResource(
+ shouldFetch = { it.isEmpty() || forceRefresh },
+ query = { local.getNotes(student) },
+ fetch = { remote.getNotes(student, semester) },
+ saveFetchResult = { old, new ->
+ local.deleteNotes(old uniqueSubtract new)
+ local.saveNotes((new uniqueSubtract old).onEach {
+ if (it.date >= student.registrationDate.toLocalDate()) it.apply {
+ isRead = false
+ if (notify) isNotified = false
+ }
+ })
+ }
+ )
+
+ fun getNotNotifiedNotes(student: Student): Flow> {
+ return local.getNotes(student).map { it.filter { note -> !note.isNotified } }
+ }
+
+ suspend fun updateNote(note: Note) {
+ local.updateNotes(listOf(note))
+ }
+
+ suspend fun updateNotes(notes: List) {
+ return local.updateNotes(notes)
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/PreferencesRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/preferences/PreferencesRepository.kt
similarity index 98%
rename from app/src/main/java/io/github/wulkanowy/data/repositories/PreferencesRepository.kt
rename to app/src/main/java/io/github/wulkanowy/data/repositories/preferences/PreferencesRepository.kt
index 8cb815cc..da31751a 100644
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/PreferencesRepository.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/preferences/PreferencesRepository.kt
@@ -1,4 +1,4 @@
-package io.github.wulkanowy.data.repositories
+package io.github.wulkanowy.data.repositories.preferences
import android.content.Context
import android.content.SharedPreferences
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/recipient/RecipientLocal.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/recipient/RecipientLocal.kt
new file mode 100644
index 00000000..fac1645e
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/recipient/RecipientLocal.kt
@@ -0,0 +1,24 @@
+package io.github.wulkanowy.data.repositories.recipient
+
+import io.github.wulkanowy.data.db.dao.RecipientDao
+import io.github.wulkanowy.data.db.entities.Recipient
+import io.github.wulkanowy.data.db.entities.ReportingUnit
+import io.github.wulkanowy.data.db.entities.Student
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class RecipientLocal @Inject constructor(private val recipientDb: RecipientDao) {
+
+ suspend fun getRecipients(student: Student, role: Int, unit: ReportingUnit): List {
+ return recipientDb.load(student.studentId, role, unit.realId)
+ }
+
+ suspend fun saveRecipients(recipients: List): List {
+ return recipientDb.insertAll(recipients)
+ }
+
+ suspend fun deleteRecipients(recipients: List) {
+ recipientDb.deleteAll(recipients)
+ }
+}
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
new file mode 100644
index 00000000..a5318e77
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/recipient/RecipientRemote.kt
@@ -0,0 +1,38 @@
+package io.github.wulkanowy.data.repositories.recipient
+
+import io.github.wulkanowy.data.db.entities.Message
+import io.github.wulkanowy.data.db.entities.Recipient
+import io.github.wulkanowy.data.db.entities.ReportingUnit
+import io.github.wulkanowy.data.db.entities.Student
+import io.github.wulkanowy.sdk.Sdk
+import io.github.wulkanowy.utils.init
+import javax.inject.Inject
+import javax.inject.Singleton
+import io.github.wulkanowy.sdk.pojo.Recipient as SdkRecipient
+
+@Singleton
+class RecipientRemote @Inject constructor(private val sdk: Sdk) {
+
+ suspend fun getRecipients(student: Student, role: Int, unit: ReportingUnit): List {
+ return sdk.init(student).getRecipients(unit.realId, role)
+ .map { it.toRecipient() }
+ }
+
+ suspend fun getMessageRecipients(student: Student, message: Message): List {
+ return sdk.init(student).getMessageRecipients(message.messageId, message.senderId)
+ .map { it.toRecipient() }
+ }
+
+ private fun SdkRecipient.toRecipient(): Recipient {
+ return Recipient(
+ studentId = sdk.studentId,
+ realId = id,
+ realName = name,
+ name = shortName,
+ hash = hash,
+ loginId = loginId,
+ role = role,
+ unitId = reportingUnitId ?: 0
+ )
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/recipient/RecipientRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/recipient/RecipientRepository.kt
new file mode 100644
index 00000000..f5e876b0
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/recipient/RecipientRepository.kt
@@ -0,0 +1,36 @@
+package io.github.wulkanowy.data.repositories.recipient
+
+import io.github.wulkanowy.data.db.entities.Message
+import io.github.wulkanowy.data.db.entities.Recipient
+import io.github.wulkanowy.data.db.entities.ReportingUnit
+import io.github.wulkanowy.data.db.entities.Student
+import io.github.wulkanowy.utils.uniqueSubtract
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class RecipientRepository @Inject constructor(
+ private val local: RecipientLocal,
+ private val remote: RecipientRemote
+) {
+
+ suspend fun refreshRecipients(student: Student, role: Int, unit: ReportingUnit) {
+ val new = remote.getRecipients(student, role, unit)
+ val old = local.getRecipients(student, role, unit)
+
+ local.deleteRecipients(old uniqueSubtract new)
+ local.saveRecipients(new uniqueSubtract old)
+ }
+
+ suspend fun getRecipients(student: Student, role: Int, unit: ReportingUnit): List {
+ return local.getRecipients(student, role, unit).ifEmpty {
+ refreshRecipients(student, role, unit)
+
+ local.getRecipients(student, role, unit)
+ }
+ }
+
+ suspend fun getMessageRecipients(student: Student, message: Message): List {
+ return remote.getMessageRecipients(student, message)
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/RecoverRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/recover/RecoverRemote.kt
similarity index 79%
rename from app/src/main/java/io/github/wulkanowy/data/repositories/RecoverRepository.kt
rename to app/src/main/java/io/github/wulkanowy/data/repositories/recover/RecoverRemote.kt
index 5e106355..11eac71e 100644
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/RecoverRepository.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/recover/RecoverRemote.kt
@@ -1,11 +1,11 @@
-package io.github.wulkanowy.data.repositories
+package io.github.wulkanowy.data.repositories.recover
import io.github.wulkanowy.sdk.Sdk
import javax.inject.Inject
import javax.inject.Singleton
@Singleton
-class RecoverRepository @Inject constructor(private val sdk: Sdk) {
+class RecoverRemote @Inject constructor(private val sdk: Sdk) {
suspend fun getReCaptchaSiteKey(host: String, symbol: String): Pair {
return sdk.getPasswordResetCaptchaCode(host, symbol)
@@ -15,3 +15,4 @@ class RecoverRepository @Inject constructor(private val sdk: Sdk) {
return sdk.sendPasswordResetRequest(url, symbol, email, reCaptchaResponse)
}
}
+
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/recover/RecoverRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/recover/RecoverRepository.kt
new file mode 100644
index 00000000..3117a606
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/recover/RecoverRepository.kt
@@ -0,0 +1,16 @@
+package io.github.wulkanowy.data.repositories.recover
+
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class RecoverRepository @Inject constructor(private val remote: RecoverRemote) {
+
+ suspend fun getReCaptchaSiteKey(host: String, symbol: String): Pair {
+ return remote.getReCaptchaSiteKey(host, symbol)
+ }
+
+ suspend fun sendRecoverRequest(url: String, symbol: String, email: String, reCaptchaResponse: String): String {
+ return remote.sendRecoverRequest(url, symbol, email, reCaptchaResponse)
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/reportingunit/ReportingUnitLocal.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/reportingunit/ReportingUnitLocal.kt
new file mode 100644
index 00000000..737f1a04
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/reportingunit/ReportingUnitLocal.kt
@@ -0,0 +1,27 @@
+package io.github.wulkanowy.data.repositories.reportingunit
+
+import io.github.wulkanowy.data.db.dao.ReportingUnitDao
+import io.github.wulkanowy.data.db.entities.ReportingUnit
+import io.github.wulkanowy.data.db.entities.Student
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class ReportingUnitLocal @Inject constructor(private val reportingUnitDb: ReportingUnitDao) {
+
+ suspend fun getReportingUnits(student: Student): List {
+ return reportingUnitDb.load(student.studentId)
+ }
+
+ suspend fun getReportingUnit(student: Student, unitId: Int): ReportingUnit? {
+ return reportingUnitDb.loadOne(student.studentId, unitId)
+ }
+
+ suspend fun saveReportingUnits(reportingUnits: List): List {
+ return reportingUnitDb.insertAll(reportingUnits)
+ }
+
+ suspend fun deleteReportingUnits(reportingUnits: List) {
+ reportingUnitDb.deleteAll(reportingUnits)
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/reportingunit/ReportingUnitRemote.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/reportingunit/ReportingUnitRemote.kt
new file mode 100644
index 00000000..6b11c2cc
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/reportingunit/ReportingUnitRemote.kt
@@ -0,0 +1,25 @@
+package io.github.wulkanowy.data.repositories.reportingunit
+
+import io.github.wulkanowy.data.db.entities.ReportingUnit
+import io.github.wulkanowy.data.db.entities.Student
+import io.github.wulkanowy.sdk.Sdk
+import io.github.wulkanowy.utils.init
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class ReportingUnitRemote @Inject constructor(private val sdk: Sdk) {
+
+ suspend fun getReportingUnits(student: Student): List {
+ return sdk.init(student).getReportingUnits().map { unit ->
+ ReportingUnit(
+ studentId = sdk.studentId,
+ realId = unit.id,
+ roles = unit.roles,
+ senderId = unit.senderId,
+ senderName = unit.senderName,
+ shortName = unit.short
+ )
+ }
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/reportingunit/ReportingUnitRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/reportingunit/ReportingUnitRepository.kt
new file mode 100644
index 00000000..ff583946
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/reportingunit/ReportingUnitRepository.kt
@@ -0,0 +1,38 @@
+package io.github.wulkanowy.data.repositories.reportingunit
+
+import io.github.wulkanowy.data.db.entities.ReportingUnit
+import io.github.wulkanowy.data.db.entities.Student
+import io.github.wulkanowy.utils.uniqueSubtract
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class ReportingUnitRepository @Inject constructor(
+ private val local: ReportingUnitLocal,
+ private val remote: ReportingUnitRemote
+) {
+
+ suspend fun refreshReportingUnits(student: Student) {
+ val new = remote.getReportingUnits(student)
+ val old = local.getReportingUnits(student)
+
+ local.deleteReportingUnits(old.uniqueSubtract(new))
+ local.saveReportingUnits(new.uniqueSubtract(old))
+ }
+
+ suspend fun getReportingUnits(student: Student): List {
+ return local.getReportingUnits(student).ifEmpty {
+ refreshReportingUnits(student)
+
+ local.getReportingUnits(student)
+ }
+ }
+
+ suspend fun getReportingUnit(student: Student, unitId: Int): ReportingUnit? {
+ return local.getReportingUnit(student, unitId) ?: run {
+ refreshReportingUnits(student)
+
+ return local.getReportingUnit(student, unitId)
+ }
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/school/SchoolLocal.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/school/SchoolLocal.kt
new file mode 100644
index 00000000..bc1b2f44
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/school/SchoolLocal.kt
@@ -0,0 +1,22 @@
+package io.github.wulkanowy.data.repositories.school
+
+import io.github.wulkanowy.data.db.dao.SchoolDao
+import io.github.wulkanowy.data.db.entities.School
+import io.github.wulkanowy.data.db.entities.Semester
+import kotlinx.coroutines.flow.Flow
+import javax.inject.Inject
+
+class SchoolLocal @Inject constructor(private val schoolDb: SchoolDao) {
+
+ suspend fun saveSchool(school: School) {
+ schoolDb.insertAll(listOf(school))
+ }
+
+ suspend fun deleteSchool(school: School) {
+ schoolDb.deleteAll(listOf(school))
+ }
+
+ fun getSchool(semester: Semester): Flow {
+ return schoolDb.load(semester.studentId, semester.classId)
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/school/SchoolRemote.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/school/SchoolRemote.kt
new file mode 100644
index 00000000..4d2e0cd6
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/school/SchoolRemote.kt
@@ -0,0 +1,27 @@
+package io.github.wulkanowy.data.repositories.school
+
+import io.github.wulkanowy.data.db.entities.School
+import io.github.wulkanowy.data.db.entities.Semester
+import io.github.wulkanowy.data.db.entities.Student
+import io.github.wulkanowy.sdk.Sdk
+import io.github.wulkanowy.utils.init
+import javax.inject.Inject
+
+class SchoolRemote @Inject constructor(private val sdk: Sdk) {
+
+ suspend fun getSchoolInfo(student: Student, semester: Semester): School {
+ return sdk.init(student).switchDiary(semester.diaryId, semester.schoolYear)
+ .getSchool()
+ .let {
+ School(
+ studentId = semester.studentId,
+ classId = semester.classId,
+ name = it.name,
+ address = it.address,
+ contact = it.contact,
+ headmaster = it.headmaster,
+ pedagogue = it.pedagogue
+ )
+ }
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/school/SchoolRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/school/SchoolRepository.kt
new file mode 100644
index 00000000..4c84c319
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/school/SchoolRepository.kt
@@ -0,0 +1,27 @@
+package io.github.wulkanowy.data.repositories.school
+
+import io.github.wulkanowy.data.db.entities.Semester
+import io.github.wulkanowy.data.db.entities.Student
+import io.github.wulkanowy.utils.networkBoundResource
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class SchoolRepository @Inject constructor(
+ private val local: SchoolLocal,
+ private val remote: SchoolRemote
+) {
+
+ fun getSchoolInfo(student: Student, semester: Semester, forceRefresh: Boolean) = networkBoundResource(
+ shouldFetch = { it == null || forceRefresh },
+ query = { local.getSchool(semester) },
+ fetch = { remote.getSchoolInfo(student, semester) },
+ saveFetchResult = { old, new ->
+ if (new != old && old != null) {
+ local.deleteSchool(old)
+ local.saveSchool(new)
+ }
+ local.saveSchool(new)
+ }
+ )
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/semester/SemesterLocal.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/semester/SemesterLocal.kt
new file mode 100644
index 00000000..8ecf1595
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/semester/SemesterLocal.kt
@@ -0,0 +1,23 @@
+package io.github.wulkanowy.data.repositories.semester
+
+import io.github.wulkanowy.data.db.dao.SemesterDao
+import io.github.wulkanowy.data.db.entities.Semester
+import io.github.wulkanowy.data.db.entities.Student
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class SemesterLocal @Inject constructor(private val semesterDb: SemesterDao) {
+
+ suspend fun saveSemesters(semesters: List) {
+ semesterDb.insertSemesters(semesters)
+ }
+
+ suspend fun deleteSemesters(semesters: List) {
+ semesterDb.deleteAll(semesters)
+ }
+
+ suspend fun getSemesters(student: Student): List {
+ return semesterDb.loadAll(student.studentId, student.classId)
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/semester/SemesterRemote.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/semester/SemesterRemote.kt
new file mode 100644
index 00000000..e1a920b6
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/semester/SemesterRemote.kt
@@ -0,0 +1,29 @@
+package io.github.wulkanowy.data.repositories.semester
+
+import io.github.wulkanowy.data.db.entities.Semester
+import io.github.wulkanowy.data.db.entities.Student
+import io.github.wulkanowy.sdk.Sdk
+import io.github.wulkanowy.utils.init
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class SemesterRemote @Inject constructor(private val sdk: Sdk) {
+
+ suspend fun getSemesters(student: Student): List {
+ return sdk.init(student).getSemesters().map {
+ Semester(
+ studentId = student.studentId,
+ diaryId = it.diaryId,
+ diaryName = it.diaryName,
+ schoolYear = it.schoolYear,
+ semesterId = it.semesterId,
+ semesterName = it.semesterNumber,
+ start = it.start,
+ end = it.end,
+ classId = it.classId,
+ unitId = it.unitId
+ )
+ }
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/SemesterRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/semester/SemesterRepository.kt
similarity index 73%
rename from app/src/main/java/io/github/wulkanowy/data/repositories/SemesterRepository.kt
rename to app/src/main/java/io/github/wulkanowy/data/repositories/semester/SemesterRepository.kt
index 8942391c..2748f1df 100644
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/SemesterRepository.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/semester/SemesterRepository.kt
@@ -1,13 +1,10 @@
-package io.github.wulkanowy.data.repositories
+package io.github.wulkanowy.data.repositories.semester
-import io.github.wulkanowy.data.db.dao.SemesterDao
import io.github.wulkanowy.data.db.entities.Semester
import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.data.mappers.mapToEntities
import io.github.wulkanowy.sdk.Sdk
import io.github.wulkanowy.utils.DispatchersProvider
import io.github.wulkanowy.utils.getCurrentOrLast
-import io.github.wulkanowy.utils.init
import io.github.wulkanowy.utils.isCurrent
import io.github.wulkanowy.utils.uniqueSubtract
import kotlinx.coroutines.withContext
@@ -17,17 +14,17 @@ import javax.inject.Singleton
@Singleton
class SemesterRepository @Inject constructor(
- private val semesterDb: SemesterDao,
- private val sdk: Sdk,
+ private val remote: SemesterRemote,
+ private val local: SemesterLocal,
private val dispatchers: DispatchersProvider
) {
suspend fun getSemesters(student: Student, forceRefresh: Boolean = false, refreshOnNoCurrent: Boolean = false) = withContext(dispatchers.backgroundThread) {
- val semesters = semesterDb.loadAll(student.studentId, student.classId)
+ val semesters = local.getSemesters(student)
if (isShouldFetch(student, semesters, forceRefresh, refreshOnNoCurrent)) {
refreshSemesters(student)
- semesterDb.loadAll(student.studentId, student.classId)
+ local.getSemesters(student)
} else semesters
}
@@ -44,12 +41,12 @@ class SemesterRepository @Inject constructor(
}
private suspend fun refreshSemesters(student: Student) {
- val new = sdk.init(student).getSemesters().mapToEntities(student.studentId)
+ val new = remote.getSemesters(student)
if (new.isEmpty()) return Timber.i("Empty semester list!")
- val old = semesterDb.loadAll(student.studentId, student.classId)
- semesterDb.deleteAll(old.uniqueSubtract(new))
- semesterDb.insertSemesters(new.uniqueSubtract(old))
+ val old = local.getSemesters(student)
+ local.deleteSemesters(old.uniqueSubtract(new))
+ local.saveSemesters(new.uniqueSubtract(old))
}
suspend fun getCurrentSemester(student: Student, forceRefresh: Boolean = false) = withContext(dispatchers.backgroundThread) {
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/student/StudentLocal.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/student/StudentLocal.kt
new file mode 100644
index 00000000..c01d1d04
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/student/StudentLocal.kt
@@ -0,0 +1,59 @@
+package io.github.wulkanowy.data.repositories.student
+
+import android.content.Context
+import dagger.hilt.android.qualifiers.ApplicationContext
+import io.github.wulkanowy.data.db.dao.StudentDao
+import io.github.wulkanowy.data.db.entities.Student
+import io.github.wulkanowy.sdk.Sdk
+import io.github.wulkanowy.utils.DispatchersProvider
+import io.github.wulkanowy.utils.security.decrypt
+import io.github.wulkanowy.utils.security.encrypt
+import kotlinx.coroutines.withContext
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class StudentLocal @Inject constructor(
+ private val studentDb: StudentDao,
+ private val dispatchers: DispatchersProvider,
+ @ApplicationContext private val context: Context
+) {
+
+ suspend fun saveStudents(students: List) = withContext(dispatchers.backgroundThread) {
+ studentDb.insertAll(students.map {
+ if (Sdk.Mode.valueOf(it.loginMode) != Sdk.Mode.API) it.copy(password = encrypt(it.password, context))
+ else it
+ })
+ }
+
+ suspend fun getStudents(decryptPass: Boolean) = withContext(dispatchers.backgroundThread) {
+ studentDb.loadStudentsWithSemesters().map {
+ it.apply {
+ if (decryptPass && Sdk.Mode.valueOf(student.loginMode) != Sdk.Mode.API) student.password = decrypt(student.password)
+ }
+ }
+ }
+
+ suspend fun getStudentById(id: Int) = withContext(dispatchers.backgroundThread) {
+ studentDb.loadById(id)?.apply {
+ if (Sdk.Mode.valueOf(loginMode) != Sdk.Mode.API) password = decrypt(password)
+ }
+ }
+
+ suspend fun getCurrentStudent(decryptPass: Boolean) = withContext(dispatchers.backgroundThread) {
+ studentDb.loadCurrent()?.apply {
+ if (decryptPass && Sdk.Mode.valueOf(loginMode) != Sdk.Mode.API) password = decrypt(password)
+ }
+ }
+
+ suspend fun setCurrentStudent(student: Student) = withContext(dispatchers.backgroundThread) {
+ studentDb.run {
+ resetCurrent()
+ updateCurrent(student.id)
+ }
+ }
+
+ suspend fun logoutStudent(student: Student) = withContext(dispatchers.backgroundThread) {
+ studentDb.delete(student)
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/student/StudentRemote.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/student/StudentRemote.kt
index e69de29b..dcb12623 100644
--- a/app/src/main/java/io/github/wulkanowy/data/repositories/student/StudentRemote.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/student/StudentRemote.kt
@@ -0,0 +1,23 @@
+package io.github.wulkanowy.data.repositories.student
+
+import io.github.wulkanowy.data.mappers.mapToEntities
+import io.github.wulkanowy.data.db.entities.StudentWithSemesters
+import io.github.wulkanowy.sdk.Sdk
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class StudentRemote @Inject constructor(private val sdk: Sdk) {
+
+ suspend fun getStudentsMobileApi(token: String, pin: String, symbol: String): List {
+ return sdk.getStudentsFromMobileApi(token, pin, symbol, "").mapToEntities()
+ }
+
+ suspend fun getStudentsScrapper(email: String, password: String, scrapperBaseUrl: String, symbol: String): List {
+ return sdk.getStudentsFromScrapper(email, password, scrapperBaseUrl, symbol).mapToEntities(password)
+ }
+
+ suspend fun getStudentsHybrid(email: String, password: String, scrapperBaseUrl: String, symbol: String): List {
+ return sdk.getStudentsHybrid(email, password, scrapperBaseUrl, "", symbol).mapToEntities(password)
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/student/StudentRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/student/StudentRepository.kt
new file mode 100644
index 00000000..19e0e208
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/student/StudentRepository.kt
@@ -0,0 +1,57 @@
+package io.github.wulkanowy.data.repositories.student
+
+import io.github.wulkanowy.data.db.entities.Student
+import io.github.wulkanowy.data.exceptions.NoCurrentStudentException
+import io.github.wulkanowy.data.db.entities.StudentWithSemesters
+import io.github.wulkanowy.data.repositories.semester.SemesterLocal
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class StudentRepository @Inject constructor(
+ private val local: StudentLocal,
+ private val semestersLocal: SemesterLocal,
+ private val remote: StudentRemote
+) {
+
+ suspend fun isStudentSaved(): Boolean = local.getStudents(false).isNotEmpty()
+
+ suspend fun isCurrentStudentSet(): Boolean = local.getCurrentStudent(false)?.isCurrent ?: false
+
+ suspend fun getStudentsApi(pin: String, symbol: String, token: String): List {
+ return remote.getStudentsMobileApi(token, pin, symbol)
+ }
+
+ suspend fun getStudentsScrapper(email: String, password: String, endpoint: String, symbol: String): List {
+ return remote.getStudentsScrapper(email, password, endpoint, symbol)
+ }
+
+ suspend fun getStudentsHybrid(email: String, password: String, endpoint: String, symbol: String): List {
+ return remote.getStudentsHybrid(email, password, endpoint, symbol)
+ }
+
+ suspend fun getSavedStudents(decryptPass: Boolean = true): List {
+ return local.getStudents(decryptPass)
+ }
+
+ suspend fun getStudentById(id: Int): Student {
+ return local.getStudentById(id) ?: throw NoCurrentStudentException()
+ }
+
+ suspend fun getCurrentStudent(decryptPass: Boolean = true): Student {
+ return local.getCurrentStudent(decryptPass) ?: throw NoCurrentStudentException()
+ }
+
+ suspend fun saveStudents(studentsWithSemesters: List): List {
+ semestersLocal.saveSemesters(studentsWithSemesters.flatMap { it.semesters })
+ return local.saveStudents(studentsWithSemesters.map { it.student })
+ }
+
+ suspend fun switchStudent(studentWithSemesters: StudentWithSemesters) {
+ return local.setCurrentStudent(studentWithSemesters.student)
+ }
+
+ suspend fun logoutStudent(student: Student) {
+ return local.logoutStudent(student)
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/subject/SubjectLocal.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/subject/SubjectLocal.kt
new file mode 100644
index 00000000..e225a381
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/subject/SubjectLocal.kt
@@ -0,0 +1,24 @@
+package io.github.wulkanowy.data.repositories.subject
+
+import io.github.wulkanowy.data.db.dao.SubjectDao
+import io.github.wulkanowy.data.db.entities.Semester
+import io.github.wulkanowy.data.db.entities.Subject
+import kotlinx.coroutines.flow.Flow
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class SubjectLocal @Inject constructor(private val subjectDao: SubjectDao) {
+
+ fun getSubjects(semester: Semester): Flow> {
+ return subjectDao.loadAll(semester.diaryId, semester.studentId)
+ }
+
+ suspend fun saveSubjects(subjects: List) {
+ subjectDao.insertAll(subjects)
+ }
+
+ suspend fun deleteSubjects(subjects: List) {
+ subjectDao.deleteAll(subjects)
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/subject/SubjectRemote.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/subject/SubjectRemote.kt
new file mode 100644
index 00000000..624a5a00
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/subject/SubjectRemote.kt
@@ -0,0 +1,26 @@
+package io.github.wulkanowy.data.repositories.subject
+
+import io.github.wulkanowy.data.db.entities.Semester
+import io.github.wulkanowy.data.db.entities.Student
+import io.github.wulkanowy.data.db.entities.Subject
+import io.github.wulkanowy.sdk.Sdk
+import io.github.wulkanowy.utils.init
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class SubjectRemote @Inject constructor(private val sdk: Sdk) {
+
+ suspend fun getSubjects(student: Student, semester: Semester): List {
+ return sdk.init(student).switchDiary(semester.diaryId, semester.schoolYear)
+ .getSubjects()
+ .map {
+ Subject(
+ studentId = semester.studentId,
+ diaryId = semester.diaryId,
+ name = it.name,
+ realId = it.id
+ )
+ }
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/subject/SubjectRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/subject/SubjectRepository.kt
new file mode 100644
index 00000000..60a0c3e7
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/subject/SubjectRepository.kt
@@ -0,0 +1,25 @@
+package io.github.wulkanowy.data.repositories.subject
+
+import io.github.wulkanowy.data.db.entities.Semester
+import io.github.wulkanowy.data.db.entities.Student
+import io.github.wulkanowy.utils.networkBoundResource
+import io.github.wulkanowy.utils.uniqueSubtract
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class SubjectRepository @Inject constructor(
+ private val local: SubjectLocal,
+ private val remote: SubjectRemote
+) {
+
+ fun getSubjects(student: Student, semester: Semester, forceRefresh: Boolean = false) = networkBoundResource(
+ shouldFetch = { it.isEmpty() || forceRefresh },
+ query = { local.getSubjects(semester) },
+ fetch = { remote.getSubjects(student, semester) },
+ saveFetchResult = { old, new ->
+ local.deleteSubjects(old uniqueSubtract new)
+ local.saveSubjects(new uniqueSubtract old)
+ }
+ )
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/teacher/TeacherLocal.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/teacher/TeacherLocal.kt
new file mode 100644
index 00000000..908f45a1
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/teacher/TeacherLocal.kt
@@ -0,0 +1,22 @@
+package io.github.wulkanowy.data.repositories.teacher
+
+import io.github.wulkanowy.data.db.dao.TeacherDao
+import io.github.wulkanowy.data.db.entities.Semester
+import io.github.wulkanowy.data.db.entities.Teacher
+import kotlinx.coroutines.flow.Flow
+import javax.inject.Inject
+
+class TeacherLocal @Inject constructor(private val teacherDb: TeacherDao) {
+
+ suspend fun saveTeachers(teachers: List) {
+ teacherDb.insertAll(teachers)
+ }
+
+ suspend fun deleteTeachers(teachers: List) {
+ teacherDb.deleteAll(teachers)
+ }
+
+ fun getTeachers(semester: Semester): Flow> {
+ return teacherDb.loadAll(semester.studentId, semester.classId)
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/teacher/TeacherRemote.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/teacher/TeacherRemote.kt
new file mode 100644
index 00000000..1d1caa68
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/teacher/TeacherRemote.kt
@@ -0,0 +1,27 @@
+package io.github.wulkanowy.data.repositories.teacher
+
+import io.github.wulkanowy.data.db.entities.Semester
+import io.github.wulkanowy.data.db.entities.Student
+import io.github.wulkanowy.data.db.entities.Teacher
+import io.github.wulkanowy.sdk.Sdk
+import io.github.wulkanowy.utils.init
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class TeacherRemote @Inject constructor(private val sdk: Sdk) {
+
+ suspend fun getTeachers(student: Student, semester: Semester): List {
+ return sdk.init(student).switchDiary(semester.diaryId, semester.schoolYear)
+ .getTeachers(semester.semesterId)
+ .map {
+ Teacher(
+ studentId = semester.studentId,
+ name = it.name,
+ subject = it.subject,
+ shortName = it.short,
+ classId = semester.classId
+ )
+ }
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/teacher/TeacherRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/teacher/TeacherRepository.kt
new file mode 100644
index 00000000..df25a53e
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/teacher/TeacherRepository.kt
@@ -0,0 +1,25 @@
+package io.github.wulkanowy.data.repositories.teacher
+
+import io.github.wulkanowy.data.db.entities.Semester
+import io.github.wulkanowy.data.db.entities.Student
+import io.github.wulkanowy.utils.networkBoundResource
+import io.github.wulkanowy.utils.uniqueSubtract
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class TeacherRepository @Inject constructor(
+ private val local: TeacherLocal,
+ private val remote: TeacherRemote
+) {
+
+ fun getTeachers(student: Student, semester: Semester, forceRefresh: Boolean) = networkBoundResource(
+ shouldFetch = { it.isEmpty() || forceRefresh },
+ query = { local.getTeachers(semester) },
+ fetch = { remote.getTeachers(student, semester) },
+ saveFetchResult = { old, new ->
+ local.deleteTeachers(old uniqueSubtract new)
+ local.saveTeachers(new uniqueSubtract old)
+ }
+ )
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/timetable/TimetableLocal.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/timetable/TimetableLocal.kt
new file mode 100644
index 00000000..df4bfb20
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/timetable/TimetableLocal.kt
@@ -0,0 +1,25 @@
+package io.github.wulkanowy.data.repositories.timetable
+
+import io.github.wulkanowy.data.db.dao.TimetableDao
+import io.github.wulkanowy.data.db.entities.Semester
+import io.github.wulkanowy.data.db.entities.Timetable
+import kotlinx.coroutines.flow.Flow
+import java.time.LocalDate
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class TimetableLocal @Inject constructor(private val timetableDb: TimetableDao) {
+
+ suspend fun saveTimetable(timetables: List) {
+ timetableDb.insertAll(timetables)
+ }
+
+ suspend fun deleteTimetable(timetables: List) {
+ timetableDb.deleteAll(timetables)
+ }
+
+ fun getTimetable(semester: Semester, startDate: LocalDate, endDate: LocalDate): Flow> {
+ return timetableDb.loadAll(semester.diaryId, semester.studentId, startDate, endDate)
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/timetable/TimetableRemote.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/timetable/TimetableRemote.kt
new file mode 100644
index 00000000..eef8729e
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/timetable/TimetableRemote.kt
@@ -0,0 +1,40 @@
+package io.github.wulkanowy.data.repositories.timetable
+
+import io.github.wulkanowy.data.db.entities.Semester
+import io.github.wulkanowy.data.db.entities.Student
+import io.github.wulkanowy.data.db.entities.Timetable
+import io.github.wulkanowy.sdk.Sdk
+import io.github.wulkanowy.utils.init
+import java.time.LocalDate
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class TimetableRemote @Inject constructor(private val sdk: Sdk) {
+
+ suspend fun getTimetable(student: Student, semester: Semester, startDate: LocalDate, endDate: LocalDate): List {
+ return sdk.init(student).switchDiary(semester.diaryId, semester.schoolYear)
+ .getTimetable(startDate, endDate)
+ .map {
+ Timetable(
+ studentId = semester.studentId,
+ diaryId = semester.diaryId,
+ number = it.number,
+ start = it.start,
+ end = it.end,
+ date = it.date,
+ subject = it.subject,
+ subjectOld = it.subjectOld,
+ group = it.group,
+ room = it.room,
+ roomOld = it.roomOld,
+ teacher = it.teacher,
+ teacherOld = it.teacherOld,
+ info = it.info,
+ isStudentPlan = it.studentPlan,
+ changes = it.changes,
+ canceled = it.canceled
+ )
+ }
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/timetable/TimetableRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/timetable/TimetableRepository.kt
new file mode 100644
index 00000000..ee2734aa
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/data/repositories/timetable/TimetableRepository.kt
@@ -0,0 +1,41 @@
+package io.github.wulkanowy.data.repositories.timetable
+
+import io.github.wulkanowy.data.db.entities.Semester
+import io.github.wulkanowy.data.db.entities.Student
+import io.github.wulkanowy.services.alarm.TimetableNotificationSchedulerHelper
+import io.github.wulkanowy.utils.monday
+import io.github.wulkanowy.utils.networkBoundResource
+import io.github.wulkanowy.utils.sunday
+import io.github.wulkanowy.utils.uniqueSubtract
+import kotlinx.coroutines.flow.map
+import java.time.LocalDate
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class TimetableRepository @Inject constructor(
+ private val local: TimetableLocal,
+ private val remote: TimetableRemote,
+ private val schedulerHelper: TimetableNotificationSchedulerHelper
+) {
+
+ fun getTimetable(student: Student, semester: Semester, start: LocalDate, end: LocalDate, forceRefresh: Boolean) = networkBoundResource(
+ shouldFetch = { it.isEmpty() || forceRefresh },
+ query = { local.getTimetable(semester, start.monday, end.sunday).map { schedulerHelper.scheduleNotifications(it, student); it } },
+ fetch = { remote.getTimetable(student, semester, start.monday, end.sunday) },
+ saveFetchResult = { old, new ->
+ local.deleteTimetable(old.uniqueSubtract(new).also { schedulerHelper.cancelScheduled(it) })
+ local.saveTimetable(new.uniqueSubtract(old).also { schedulerHelper.scheduleNotifications(it, student) }.map { item ->
+ item.also { new ->
+ old.singleOrNull { new.start == it.start }?.let { old ->
+ return@map new.copy(
+ room = if (new.room.isEmpty()) old.room else new.room,
+ teacher = if (new.teacher.isEmpty() && !new.changes && !old.changes) old.teacher else new.teacher
+ )
+ }
+ }
+ })
+ },
+ filterResult = { it.filter { item -> item.date in start..end } }
+ )
+}
diff --git a/app/src/main/java/io/github/wulkanowy/di/AppModule.kt b/app/src/main/java/io/github/wulkanowy/di/AppModule.kt
index 4efb4d84..9133c34e 100644
--- a/app/src/main/java/io/github/wulkanowy/di/AppModule.kt
+++ b/app/src/main/java/io/github/wulkanowy/di/AppModule.kt
@@ -6,13 +6,13 @@ import com.yariksoffice.lingver.Lingver
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
+import dagger.hilt.android.components.ApplicationComponent
import dagger.hilt.android.qualifiers.ApplicationContext
-import dagger.hilt.components.SingletonComponent
import io.github.wulkanowy.utils.DispatchersProvider
import javax.inject.Singleton
@Module
-@InstallIn(SingletonComponent::class)
+@InstallIn(ApplicationComponent::class)
internal class AppModule {
@Singleton
diff --git a/app/src/main/java/io/github/wulkanowy/services/ServicesModule.kt b/app/src/main/java/io/github/wulkanowy/services/ServicesModule.kt
index 891f07da..ac5a84e8 100644
--- a/app/src/main/java/io/github/wulkanowy/services/ServicesModule.kt
+++ b/app/src/main/java/io/github/wulkanowy/services/ServicesModule.kt
@@ -9,8 +9,8 @@ import dagger.Binds
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
+import dagger.hilt.android.components.ApplicationComponent
import dagger.hilt.android.qualifiers.ApplicationContext
-import dagger.hilt.components.SingletonComponent
import dagger.multibindings.IntoSet
import io.github.wulkanowy.services.sync.channels.Channel
import io.github.wulkanowy.services.sync.channels.DebugChannel
@@ -38,7 +38,7 @@ import javax.inject.Singleton
@Suppress("unused")
@Module
-@InstallIn(SingletonComponent::class)
+@InstallIn(ApplicationComponent::class)
abstract class ServicesModule {
companion object {
diff --git a/app/src/main/java/io/github/wulkanowy/services/alarm/TimetableNotificationReceiver.kt b/app/src/main/java/io/github/wulkanowy/services/alarm/TimetableNotificationReceiver.kt
index 8eefc032..592d0919 100644
--- a/app/src/main/java/io/github/wulkanowy/services/alarm/TimetableNotificationReceiver.kt
+++ b/app/src/main/java/io/github/wulkanowy/services/alarm/TimetableNotificationReceiver.kt
@@ -12,7 +12,7 @@ import androidx.core.app.NotificationManagerCompat
import dagger.hilt.android.AndroidEntryPoint
import io.github.wulkanowy.R
import io.github.wulkanowy.data.Status
-import io.github.wulkanowy.data.repositories.StudentRepository
+import io.github.wulkanowy.data.repositories.student.StudentRepository
import io.github.wulkanowy.services.HiltBroadcastReceiver
import io.github.wulkanowy.services.sync.channels.UpcomingLessonsChannel.Companion.CHANNEL_ID
import io.github.wulkanowy.ui.modules.main.MainActivity
diff --git a/app/src/main/java/io/github/wulkanowy/services/alarm/TimetableNotificationSchedulerHelper.kt b/app/src/main/java/io/github/wulkanowy/services/alarm/TimetableNotificationSchedulerHelper.kt
index c5a5590b..2593a555 100644
--- a/app/src/main/java/io/github/wulkanowy/services/alarm/TimetableNotificationSchedulerHelper.kt
+++ b/app/src/main/java/io/github/wulkanowy/services/alarm/TimetableNotificationSchedulerHelper.kt
@@ -11,7 +11,7 @@ import androidx.core.app.NotificationManagerCompat
import dagger.hilt.android.qualifiers.ApplicationContext
import io.github.wulkanowy.data.db.entities.Student
import io.github.wulkanowy.data.db.entities.Timetable
-import io.github.wulkanowy.data.repositories.PreferencesRepository
+import io.github.wulkanowy.data.repositories.preferences.PreferencesRepository
import io.github.wulkanowy.services.alarm.TimetableNotificationReceiver.Companion.LESSON_END
import io.github.wulkanowy.services.alarm.TimetableNotificationReceiver.Companion.LESSON_NEXT_ROOM
import io.github.wulkanowy.services.alarm.TimetableNotificationReceiver.Companion.LESSON_NEXT_TITLE
@@ -27,7 +27,6 @@ import io.github.wulkanowy.services.alarm.TimetableNotificationReceiver.Companio
import io.github.wulkanowy.services.alarm.TimetableNotificationReceiver.Companion.STUDENT_NAME
import io.github.wulkanowy.ui.modules.main.MainView
import io.github.wulkanowy.utils.DispatchersProvider
-import io.github.wulkanowy.utils.nickOrName
import io.github.wulkanowy.utils.toTimestamp
import kotlinx.coroutines.withContext
import timber.log.Timber
@@ -42,23 +41,17 @@ class TimetableNotificationSchedulerHelper @Inject constructor(
private val dispatchersProvider: DispatchersProvider,
) {
- private fun getRequestCode(time: LocalDateTime, studentId: Int) =
- (time.toTimestamp() * studentId).toInt()
+ private fun getRequestCode(time: LocalDateTime, studentId: Int) = (time.toTimestamp() * studentId).toInt()
- private fun getUpcomingLessonTime(
- index: Int,
- day: List,
- lesson: Timetable
- ) = day.getOrNull(index - 1)?.end ?: lesson.start.minusMinutes(30)
+ private fun getUpcomingLessonTime(index: Int, day: List, lesson: Timetable): LocalDateTime {
+ return day.getOrNull(index - 1)?.end ?: lesson.start.minusMinutes(30)
+ }
suspend fun cancelScheduled(lessons: List, studentId: Int = 1) {
withContext(dispatchersProvider.backgroundThread) {
lessons.sortedBy { it.start }.forEachIndexed { index, lesson ->
val upcomingTime = getUpcomingLessonTime(index, lessons, lesson)
- cancelScheduledTo(
- upcomingTime..lesson.start,
- getRequestCode(upcomingTime, studentId)
- )
+ cancelScheduledTo(upcomingTime..lesson.start, getRequestCode(upcomingTime, studentId))
cancelScheduledTo(lesson.start..lesson.end, getRequestCode(lesson.start, studentId))
Timber.d("TimetableNotification canceled: type 1 & 2, subject: ${lesson.subject}, start: ${lesson.start}, student: $studentId")
@@ -68,18 +61,13 @@ class TimetableNotificationSchedulerHelper @Inject constructor(
private fun cancelScheduledTo(range: ClosedRange, requestCode: Int) {
if (now() in range) cancelNotification()
- alarmManager.cancel(
- PendingIntent.getBroadcast(context, requestCode, Intent(), FLAG_UPDATE_CURRENT)
- )
+ alarmManager.cancel(PendingIntent.getBroadcast(context, requestCode, Intent(), FLAG_UPDATE_CURRENT))
}
- fun cancelNotification() =
- NotificationManagerCompat.from(context).cancel(MainView.Section.TIMETABLE.id)
+ fun cancelNotification() = NotificationManagerCompat.from(context).cancel(MainView.Section.TIMETABLE.id)
suspend fun scheduleNotifications(lessons: List, student: Student) {
- if (!preferencesRepository.isUpcomingLessonsNotificationsEnable) {
- return cancelScheduled(lessons, student.studentId)
- }
+ if (!preferencesRepository.isUpcomingLessonsNotificationsEnable) return cancelScheduled(lessons, student.studentId)
withContext(dispatchersProvider.backgroundThread) {
lessons.groupBy { it.date }
@@ -94,28 +82,13 @@ class TimetableNotificationSchedulerHelper @Inject constructor(
val intent = createIntent(student, lesson, active.getOrNull(index + 1))
if (lesson.start > now()) {
- scheduleBroadcast(
- intent,
- student.studentId,
- NOTIFICATION_TYPE_UPCOMING,
- getUpcomingLessonTime(index, active, lesson)
- )
+ scheduleBroadcast(intent, student.studentId, NOTIFICATION_TYPE_UPCOMING, getUpcomingLessonTime(index, active, lesson))
}
if (lesson.end > now()) {
- scheduleBroadcast(
- intent,
- student.studentId,
- NOTIFICATION_TYPE_CURRENT,
- lesson.start
- )
+ scheduleBroadcast(intent, student.studentId, NOTIFICATION_TYPE_CURRENT, lesson.start)
if (active.lastIndex == index) {
- scheduleBroadcast(
- intent,
- student.studentId,
- NOTIFICATION_TYPE_LAST_LESSON_CANCELLATION,
- lesson.end
- )
+ scheduleBroadcast(intent, student.studentId, NOTIFICATION_TYPE_LAST_LESSON_CANCELLATION, lesson.end)
}
}
}
@@ -126,7 +99,7 @@ class TimetableNotificationSchedulerHelper @Inject constructor(
private fun createIntent(student: Student, lesson: Timetable, nextLesson: Timetable?): Intent {
return Intent(context, TimetableNotificationReceiver::class.java).apply {
putExtra(STUDENT_ID, student.studentId)
- putExtra(STUDENT_NAME, student.nickOrName)
+ putExtra(STUDENT_NAME, student.studentName)
putExtra(LESSON_ROOM, lesson.room)
putExtra(LESSON_START, lesson.start.toTimestamp())
putExtra(LESSON_END, lesson.end.toTimestamp())
@@ -136,23 +109,13 @@ class TimetableNotificationSchedulerHelper @Inject constructor(
}
}
- private fun scheduleBroadcast(
- intent: Intent,
- studentId: Int,
- notificationType: Int,
- time: LocalDateTime
- ) {
- AlarmManagerCompat.setExactAndAllowWhileIdle(
- alarmManager, RTC_WAKEUP, time.toTimestamp(),
+ private fun scheduleBroadcast(intent: Intent, studentId: Int, notificationType: Int, time: LocalDateTime) {
+ AlarmManagerCompat.setExactAndAllowWhileIdle(alarmManager, RTC_WAKEUP, time.toTimestamp(),
PendingIntent.getBroadcast(context, getRequestCode(time, studentId), intent.also {
it.putExtra(NOTIFICATION_ID, MainView.Section.TIMETABLE.id)
it.putExtra(LESSON_TYPE, notificationType)
}, FLAG_UPDATE_CURRENT)
)
- Timber.d(
- "TimetableNotification scheduled: type: $notificationType, subject: ${
- intent.getStringExtra(LESSON_TITLE)
- }, start: $time, student: $studentId"
- )
+ Timber.d("TimetableNotification scheduled: type: $notificationType, subject: ${intent.getStringExtra(LESSON_TITLE)}, start: $time, student: $studentId")
}
}
diff --git a/app/src/main/java/io/github/wulkanowy/services/sync/SyncManager.kt b/app/src/main/java/io/github/wulkanowy/services/sync/SyncManager.kt
index b94d97e3..47a94927 100644
--- a/app/src/main/java/io/github/wulkanowy/services/sync/SyncManager.kt
+++ b/app/src/main/java/io/github/wulkanowy/services/sync/SyncManager.kt
@@ -18,7 +18,7 @@ import androidx.work.WorkInfo
import androidx.work.WorkManager
import io.github.wulkanowy.data.db.SharedPrefProvider
import io.github.wulkanowy.data.db.SharedPrefProvider.Companion.APP_VERSION_CODE_KEY
-import io.github.wulkanowy.data.repositories.PreferencesRepository
+import io.github.wulkanowy.data.repositories.preferences.PreferencesRepository
import io.github.wulkanowy.services.sync.channels.Channel
import io.github.wulkanowy.utils.AppInfo
import io.github.wulkanowy.utils.isHolidays
diff --git a/app/src/main/java/io/github/wulkanowy/services/sync/SyncWorker.kt b/app/src/main/java/io/github/wulkanowy/services/sync/SyncWorker.kt
index 8b6bc65d..13326ca0 100644
--- a/app/src/main/java/io/github/wulkanowy/services/sync/SyncWorker.kt
+++ b/app/src/main/java/io/github/wulkanowy/services/sync/SyncWorker.kt
@@ -5,16 +5,15 @@ import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationCompat.BigTextStyle
import androidx.core.app.NotificationCompat.PRIORITY_DEFAULT
import androidx.core.app.NotificationManagerCompat
-import androidx.hilt.work.HiltWorker
+import androidx.hilt.Assisted
+import androidx.hilt.work.WorkerInject
import androidx.work.CoroutineWorker
import androidx.work.Data
import androidx.work.WorkerParameters
-import dagger.assisted.Assisted
-import dagger.assisted.AssistedInject
import io.github.wulkanowy.R
-import io.github.wulkanowy.data.repositories.PreferencesRepository
-import io.github.wulkanowy.data.repositories.SemesterRepository
-import io.github.wulkanowy.data.repositories.StudentRepository
+import io.github.wulkanowy.data.repositories.preferences.PreferencesRepository
+import io.github.wulkanowy.data.repositories.semester.SemesterRepository
+import io.github.wulkanowy.data.repositories.student.StudentRepository
import io.github.wulkanowy.sdk.exception.FeatureNotAvailableException
import io.github.wulkanowy.sdk.scrapper.exception.FeatureDisabledException
import io.github.wulkanowy.services.sync.channels.DebugChannel
@@ -24,8 +23,7 @@ import kotlinx.coroutines.coroutineScope
import timber.log.Timber
import kotlin.random.Random
-@HiltWorker
-class SyncWorker @AssistedInject constructor(
+class SyncWorker @WorkerInject constructor(
@Assisted appContext: Context,
@Assisted workerParameters: WorkerParameters,
private val studentRepository: StudentRepository,
@@ -60,10 +58,9 @@ class SyncWorker @AssistedInject constructor(
}
val result = when {
exceptions.isNotEmpty() && inputData.getBoolean("one_time", false) -> {
- Result.failure(
- Data.Builder()
- .putString("error", exceptions.map { it.stackTraceToString() }.toString())
- .build()
+ Result.failure(Data.Builder()
+ .putString("error", exceptions.map { it.stackTraceToString() }.toString())
+ .build()
)
}
exceptions.isNotEmpty() -> Result.retry()
@@ -77,16 +74,13 @@ class SyncWorker @AssistedInject constructor(
}
private fun notify(result: Result) {
- notificationManager.notify(
- Random.nextInt(Int.MAX_VALUE),
- NotificationCompat.Builder(applicationContext, DebugChannel.CHANNEL_ID)
- .setContentTitle("Debug notification")
- .setSmallIcon(R.drawable.ic_stat_push)
- .setAutoCancel(true)
- .setColor(applicationContext.getCompatColor(R.color.colorPrimary))
- .setStyle(BigTextStyle().bigText("${SyncWorker::class.java.simpleName} result: $result"))
- .setPriority(PRIORITY_DEFAULT)
- .build()
- )
+ notificationManager.notify(Random.nextInt(Int.MAX_VALUE), NotificationCompat.Builder(applicationContext, DebugChannel.CHANNEL_ID)
+ .setContentTitle("Debug notification")
+ .setSmallIcon(R.drawable.ic_stat_push)
+ .setAutoCancel(true)
+ .setColor(applicationContext.getCompatColor(R.color.colorPrimary))
+ .setStyle(BigTextStyle().bigText("${SyncWorker::class.java.simpleName} result: $result"))
+ .setPriority(PRIORITY_DEFAULT)
+ .build())
}
}
diff --git a/app/src/main/java/io/github/wulkanowy/services/sync/works/AttendanceSummaryWork.kt b/app/src/main/java/io/github/wulkanowy/services/sync/works/AttendanceSummaryWork.kt
index cbe1fe6b..9e4ab902 100644
--- a/app/src/main/java/io/github/wulkanowy/services/sync/works/AttendanceSummaryWork.kt
+++ b/app/src/main/java/io/github/wulkanowy/services/sync/works/AttendanceSummaryWork.kt
@@ -2,7 +2,7 @@ package io.github.wulkanowy.services.sync.works
import io.github.wulkanowy.data.db.entities.Semester
import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.data.repositories.AttendanceSummaryRepository
+import io.github.wulkanowy.data.repositories.attendancesummary.AttendanceSummaryRepository
import io.github.wulkanowy.utils.waitForResult
import javax.inject.Inject
diff --git a/app/src/main/java/io/github/wulkanowy/services/sync/works/AttendanceWork.kt b/app/src/main/java/io/github/wulkanowy/services/sync/works/AttendanceWork.kt
index 788e4ea2..ecf0be01 100644
--- a/app/src/main/java/io/github/wulkanowy/services/sync/works/AttendanceWork.kt
+++ b/app/src/main/java/io/github/wulkanowy/services/sync/works/AttendanceWork.kt
@@ -2,7 +2,7 @@ package io.github.wulkanowy.services.sync.works
import io.github.wulkanowy.data.db.entities.Semester
import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.data.repositories.AttendanceRepository
+import io.github.wulkanowy.data.repositories.attendance.AttendanceRepository
import io.github.wulkanowy.utils.monday
import io.github.wulkanowy.utils.sunday
import io.github.wulkanowy.utils.waitForResult
diff --git a/app/src/main/java/io/github/wulkanowy/services/sync/works/CompletedLessonWork.kt b/app/src/main/java/io/github/wulkanowy/services/sync/works/CompletedLessonWork.kt
index 17bd6129..212ea632 100644
--- a/app/src/main/java/io/github/wulkanowy/services/sync/works/CompletedLessonWork.kt
+++ b/app/src/main/java/io/github/wulkanowy/services/sync/works/CompletedLessonWork.kt
@@ -2,7 +2,7 @@ package io.github.wulkanowy.services.sync.works
import io.github.wulkanowy.data.db.entities.Semester
import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.data.repositories.CompletedLessonsRepository
+import io.github.wulkanowy.data.repositories.completedlessons.CompletedLessonsRepository
import io.github.wulkanowy.utils.monday
import io.github.wulkanowy.utils.sunday
import io.github.wulkanowy.utils.waitForResult
diff --git a/app/src/main/java/io/github/wulkanowy/services/sync/works/ExamWork.kt b/app/src/main/java/io/github/wulkanowy/services/sync/works/ExamWork.kt
index b7549930..899d45cb 100644
--- a/app/src/main/java/io/github/wulkanowy/services/sync/works/ExamWork.kt
+++ b/app/src/main/java/io/github/wulkanowy/services/sync/works/ExamWork.kt
@@ -2,7 +2,7 @@ package io.github.wulkanowy.services.sync.works
import io.github.wulkanowy.data.db.entities.Semester
import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.data.repositories.ExamRepository
+import io.github.wulkanowy.data.repositories.exam.ExamRepository
import io.github.wulkanowy.utils.waitForResult
import java.time.LocalDate.now
import javax.inject.Inject
diff --git a/app/src/main/java/io/github/wulkanowy/services/sync/works/GradeStatisticsWork.kt b/app/src/main/java/io/github/wulkanowy/services/sync/works/GradeStatisticsWork.kt
index 4575b419..3d61a423 100644
--- a/app/src/main/java/io/github/wulkanowy/services/sync/works/GradeStatisticsWork.kt
+++ b/app/src/main/java/io/github/wulkanowy/services/sync/works/GradeStatisticsWork.kt
@@ -2,7 +2,7 @@ package io.github.wulkanowy.services.sync.works
import io.github.wulkanowy.data.db.entities.Semester
import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.data.repositories.GradeStatisticsRepository
+import io.github.wulkanowy.data.repositories.gradestatistics.GradeStatisticsRepository
import io.github.wulkanowy.utils.waitForResult
import javax.inject.Inject
@@ -12,8 +12,8 @@ class GradeStatisticsWork @Inject constructor(
override suspend fun doWork(student: Student, semester: Semester) {
with(gradeStatisticsRepository) {
- getGradesPartialStatistics(student, semester, "Wszystkie", forceRefresh = true).waitForResult()
- getGradesSemesterStatistics(student, semester, "Wszystkie", forceRefresh = true).waitForResult()
+ getGradesStatistics(student, semester, "Wszystkie", isSemester = true, forceRefresh = true).waitForResult()
+ getGradesStatistics(student, semester, "Wszystkie", isSemester = false, forceRefresh = true).waitForResult()
getGradesPointsStatistics(student, semester, "Wszystkie", forceRefresh = true).waitForResult()
}
}
diff --git a/app/src/main/java/io/github/wulkanowy/services/sync/works/GradeWork.kt b/app/src/main/java/io/github/wulkanowy/services/sync/works/GradeWork.kt
index 19c26edd..00bce109 100644
--- a/app/src/main/java/io/github/wulkanowy/services/sync/works/GradeWork.kt
+++ b/app/src/main/java/io/github/wulkanowy/services/sync/works/GradeWork.kt
@@ -13,8 +13,8 @@ import io.github.wulkanowy.data.db.entities.Grade
import io.github.wulkanowy.data.db.entities.GradeSummary
import io.github.wulkanowy.data.db.entities.Semester
import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.data.repositories.GradeRepository
-import io.github.wulkanowy.data.repositories.PreferencesRepository
+import io.github.wulkanowy.data.repositories.grade.GradeRepository
+import io.github.wulkanowy.data.repositories.preferences.PreferencesRepository
import io.github.wulkanowy.services.sync.channels.NewGradesChannel
import io.github.wulkanowy.ui.modules.main.MainActivity
import io.github.wulkanowy.ui.modules.main.MainView
diff --git a/app/src/main/java/io/github/wulkanowy/services/sync/works/HomeworkWork.kt b/app/src/main/java/io/github/wulkanowy/services/sync/works/HomeworkWork.kt
index a16841e9..a07f1107 100644
--- a/app/src/main/java/io/github/wulkanowy/services/sync/works/HomeworkWork.kt
+++ b/app/src/main/java/io/github/wulkanowy/services/sync/works/HomeworkWork.kt
@@ -2,7 +2,7 @@ package io.github.wulkanowy.services.sync.works
import io.github.wulkanowy.data.db.entities.Semester
import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.data.repositories.HomeworkRepository
+import io.github.wulkanowy.data.repositories.homework.HomeworkRepository
import io.github.wulkanowy.utils.monday
import io.github.wulkanowy.utils.sunday
import io.github.wulkanowy.utils.waitForResult
diff --git a/app/src/main/java/io/github/wulkanowy/services/sync/works/LuckyNumberWork.kt b/app/src/main/java/io/github/wulkanowy/services/sync/works/LuckyNumberWork.kt
index 9f536553..7b9f5ab3 100644
--- a/app/src/main/java/io/github/wulkanowy/services/sync/works/LuckyNumberWork.kt
+++ b/app/src/main/java/io/github/wulkanowy/services/sync/works/LuckyNumberWork.kt
@@ -12,8 +12,8 @@ import io.github.wulkanowy.R
import io.github.wulkanowy.data.db.entities.LuckyNumber
import io.github.wulkanowy.data.db.entities.Semester
import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.data.repositories.LuckyNumberRepository
-import io.github.wulkanowy.data.repositories.PreferencesRepository
+import io.github.wulkanowy.data.repositories.luckynumber.LuckyNumberRepository
+import io.github.wulkanowy.data.repositories.preferences.PreferencesRepository
import io.github.wulkanowy.services.sync.channels.LuckyNumberChannel
import io.github.wulkanowy.ui.modules.main.MainActivity
import io.github.wulkanowy.ui.modules.main.MainView
diff --git a/app/src/main/java/io/github/wulkanowy/services/sync/works/MessageWork.kt b/app/src/main/java/io/github/wulkanowy/services/sync/works/MessageWork.kt
index 93c30b57..7b32f13b 100644
--- a/app/src/main/java/io/github/wulkanowy/services/sync/works/MessageWork.kt
+++ b/app/src/main/java/io/github/wulkanowy/services/sync/works/MessageWork.kt
@@ -12,9 +12,9 @@ import io.github.wulkanowy.R
import io.github.wulkanowy.data.db.entities.Message
import io.github.wulkanowy.data.db.entities.Semester
import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.data.enums.MessageFolder.RECEIVED
-import io.github.wulkanowy.data.repositories.MessageRepository
-import io.github.wulkanowy.data.repositories.PreferencesRepository
+import io.github.wulkanowy.data.repositories.message.MessageFolder.RECEIVED
+import io.github.wulkanowy.data.repositories.message.MessageRepository
+import io.github.wulkanowy.data.repositories.preferences.PreferencesRepository
import io.github.wulkanowy.services.sync.channels.NewMessagesChannel
import io.github.wulkanowy.ui.modules.main.MainActivity
import io.github.wulkanowy.ui.modules.main.MainView
diff --git a/app/src/main/java/io/github/wulkanowy/services/sync/works/NoteWork.kt b/app/src/main/java/io/github/wulkanowy/services/sync/works/NoteWork.kt
index 50f418ed..b0889696 100644
--- a/app/src/main/java/io/github/wulkanowy/services/sync/works/NoteWork.kt
+++ b/app/src/main/java/io/github/wulkanowy/services/sync/works/NoteWork.kt
@@ -12,8 +12,8 @@ import io.github.wulkanowy.R
import io.github.wulkanowy.data.db.entities.Note
import io.github.wulkanowy.data.db.entities.Semester
import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.data.repositories.NoteRepository
-import io.github.wulkanowy.data.repositories.PreferencesRepository
+import io.github.wulkanowy.data.repositories.note.NoteRepository
+import io.github.wulkanowy.data.repositories.preferences.PreferencesRepository
import io.github.wulkanowy.sdk.scrapper.notes.NoteCategory
import io.github.wulkanowy.sdk.scrapper.notes.NoteCategory.NEUTRAL
import io.github.wulkanowy.sdk.scrapper.notes.NoteCategory.POSITIVE
diff --git a/app/src/main/java/io/github/wulkanowy/services/sync/works/RecipientWork.kt b/app/src/main/java/io/github/wulkanowy/services/sync/works/RecipientWork.kt
index 34ab3db0..c433c0ac 100644
--- a/app/src/main/java/io/github/wulkanowy/services/sync/works/RecipientWork.kt
+++ b/app/src/main/java/io/github/wulkanowy/services/sync/works/RecipientWork.kt
@@ -2,8 +2,8 @@ package io.github.wulkanowy.services.sync.works
import io.github.wulkanowy.data.db.entities.Semester
import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.data.repositories.RecipientRepository
-import io.github.wulkanowy.data.repositories.ReportingUnitRepository
+import io.github.wulkanowy.data.repositories.recipient.RecipientRepository
+import io.github.wulkanowy.data.repositories.reportingunit.ReportingUnitRepository
import javax.inject.Inject
class RecipientWork @Inject constructor(
@@ -16,7 +16,7 @@ class RecipientWork @Inject constructor(
reportingUnitRepository.getReportingUnits(student).let { units ->
units.map {
- recipientRepository.refreshRecipients(student, it, 2)
+ recipientRepository.refreshRecipients(student, 2, it)
}
}
}
diff --git a/app/src/main/java/io/github/wulkanowy/services/sync/works/TeacherWork.kt b/app/src/main/java/io/github/wulkanowy/services/sync/works/TeacherWork.kt
index 7c614c6c..a9abdaa7 100644
--- a/app/src/main/java/io/github/wulkanowy/services/sync/works/TeacherWork.kt
+++ b/app/src/main/java/io/github/wulkanowy/services/sync/works/TeacherWork.kt
@@ -2,7 +2,7 @@ package io.github.wulkanowy.services.sync.works
import io.github.wulkanowy.data.db.entities.Semester
import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.data.repositories.TeacherRepository
+import io.github.wulkanowy.data.repositories.teacher.TeacherRepository
import io.github.wulkanowy.utils.waitForResult
import javax.inject.Inject
diff --git a/app/src/main/java/io/github/wulkanowy/services/sync/works/TimetableWork.kt b/app/src/main/java/io/github/wulkanowy/services/sync/works/TimetableWork.kt
index 2df2c9dc..3b8c6f5d 100644
--- a/app/src/main/java/io/github/wulkanowy/services/sync/works/TimetableWork.kt
+++ b/app/src/main/java/io/github/wulkanowy/services/sync/works/TimetableWork.kt
@@ -2,7 +2,7 @@ package io.github.wulkanowy.services.sync.works
import io.github.wulkanowy.data.db.entities.Semester
import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.data.repositories.TimetableRepository
+import io.github.wulkanowy.data.repositories.timetable.TimetableRepository
import io.github.wulkanowy.utils.monday
import io.github.wulkanowy.utils.sunday
import io.github.wulkanowy.utils.waitForResult
diff --git a/app/src/main/java/io/github/wulkanowy/services/widgets/TimetableWidgetService.kt b/app/src/main/java/io/github/wulkanowy/services/widgets/TimetableWidgetService.kt
index 45cd2b04..42c6d3bf 100644
--- a/app/src/main/java/io/github/wulkanowy/services/widgets/TimetableWidgetService.kt
+++ b/app/src/main/java/io/github/wulkanowy/services/widgets/TimetableWidgetService.kt
@@ -4,10 +4,10 @@ import android.content.Intent
import android.widget.RemoteViewsService
import dagger.hilt.android.AndroidEntryPoint
import io.github.wulkanowy.data.db.SharedPrefProvider
-import io.github.wulkanowy.data.repositories.PreferencesRepository
-import io.github.wulkanowy.data.repositories.SemesterRepository
-import io.github.wulkanowy.data.repositories.StudentRepository
-import io.github.wulkanowy.data.repositories.TimetableRepository
+import io.github.wulkanowy.data.repositories.preferences.PreferencesRepository
+import io.github.wulkanowy.data.repositories.semester.SemesterRepository
+import io.github.wulkanowy.data.repositories.student.StudentRepository
+import io.github.wulkanowy.data.repositories.timetable.TimetableRepository
import io.github.wulkanowy.ui.modules.timetablewidget.TimetableWidgetFactory
import timber.log.Timber
import javax.inject.Inject
diff --git a/app/src/main/java/io/github/wulkanowy/ui/base/BaseDialogFragment.kt b/app/src/main/java/io/github/wulkanowy/ui/base/BaseDialogFragment.kt
index 1c31976e..18cd58b4 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/base/BaseDialogFragment.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/base/BaseDialogFragment.kt
@@ -3,15 +3,10 @@ package io.github.wulkanowy.ui.base
import android.widget.Toast
import androidx.fragment.app.DialogFragment
import androidx.viewbinding.ViewBinding
-import io.github.wulkanowy.utils.AnalyticsHelper
import io.github.wulkanowy.utils.lifecycleAwareVariable
-import javax.inject.Inject
abstract class BaseDialogFragment : DialogFragment(), BaseView {
- @Inject
- lateinit var analyticsHelper: AnalyticsHelper
-
protected var binding: VB by lifecycleAwareVariable()
override fun showError(text: String, error: Throwable) {
@@ -33,14 +28,4 @@ abstract class BaseDialogFragment : DialogFragment(), BaseView
override fun showErrorDetailsDialog(error: Throwable) {
ErrorDialog.newInstance(error).show(childFragmentManager, error.toString())
}
-
- override fun onResume() {
- super.onResume()
- analyticsHelper.setCurrentScreen(requireActivity(), this::class.simpleName)
- }
-
- override fun onPause() {
- super.onPause()
- analyticsHelper.popCurrentScreen(this::class.simpleName)
- }
}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/base/BasePresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/base/BasePresenter.kt
index b222b0ab..ba8bfd85 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/base/BasePresenter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/base/BasePresenter.kt
@@ -1,7 +1,7 @@
package io.github.wulkanowy.ui.base
import io.github.wulkanowy.data.Status
-import io.github.wulkanowy.data.repositories.StudentRepository
+import io.github.wulkanowy.data.repositories.student.StudentRepository
import io.github.wulkanowy.utils.flowWithResource
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
diff --git a/app/src/main/java/io/github/wulkanowy/ui/base/ErrorDialog.kt b/app/src/main/java/io/github/wulkanowy/ui/base/ErrorDialog.kt
index f76614e1..341ae459 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/base/ErrorDialog.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/base/ErrorDialog.kt
@@ -57,7 +57,7 @@ class ErrorDialog : BaseDialogFragment() {
}
}
- override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
+ override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return DialogErrorBinding.inflate(inflater).apply { binding = this }.root
}
@@ -114,17 +114,11 @@ class ErrorDialog : BaseDialogFragment() {
chooserTitle = getString(R.string.about_feedback),
email = "wulkanowyinc@gmail.com",
subject = "Zgłoszenie błędu",
- body = requireContext().getString(
- R.string.about_feedback_template,
- "${appInfo.systemManufacturer} ${appInfo.systemModel}",
- appInfo.systemVersion.toString(),
- "${appInfo.versionName}-${appInfo.buildFlavor}"
+ body = requireContext().getString(R.string.about_feedback_template,
+ "${appInfo.systemManufacturer} ${appInfo.systemModel}", appInfo.systemVersion.toString(), appInfo.versionName
) + "\n" + content,
onActivityNotFound = {
- requireContext().openInternetBrowser(
- "https://github.com/wulkanowy/wulkanowy/issues",
- ::showMessage
- )
+ requireContext().openInternetBrowser("https://github.com/wulkanowy/wulkanowy/issues", ::showMessage)
}
)
}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/base/ErrorHandler.kt b/app/src/main/java/io/github/wulkanowy/ui/base/ErrorHandler.kt
index 34dd3ec1..946e661b 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/base/ErrorHandler.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/base/ErrorHandler.kt
@@ -1,6 +1,7 @@
package io.github.wulkanowy.ui.base
import android.content.res.Resources
+import com.chuckerteam.chucker.api.ChuckerCollector
import io.github.wulkanowy.data.exceptions.NoCurrentStudentException
import io.github.wulkanowy.sdk.scrapper.login.BadCredentialsException
import io.github.wulkanowy.utils.getString
@@ -8,7 +9,7 @@ import io.github.wulkanowy.utils.security.ScramblerException
import timber.log.Timber
import javax.inject.Inject
-open class ErrorHandler @Inject constructor(protected val resources: Resources) {
+open class ErrorHandler @Inject constructor(protected val resources: Resources, private val chuckerCollector: ChuckerCollector) {
var showErrorMessage: (String, Throwable) -> Unit = { _, _ -> }
@@ -17,6 +18,7 @@ open class ErrorHandler @Inject constructor(protected val resources: Resources)
var onNoCurrentStudent: () -> Unit = {}
fun dispatch(error: Throwable) {
+ chuckerCollector.onError(error.javaClass.simpleName, error)
Timber.e(error, "An exception occurred while the Wulkanowy was running")
proceed(error)
}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/base/ThemeManager.kt b/app/src/main/java/io/github/wulkanowy/ui/base/ThemeManager.kt
index a2379c3e..50134861 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/base/ThemeManager.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/base/ThemeManager.kt
@@ -7,7 +7,7 @@ import androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
import androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO
import androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES
import io.github.wulkanowy.R
-import io.github.wulkanowy.data.repositories.PreferencesRepository
+import io.github.wulkanowy.data.repositories.preferences.PreferencesRepository
import javax.inject.Inject
import javax.inject.Singleton
diff --git a/app/src/main/java/io/github/wulkanowy/ui/base/WidgetConfigureAdapter.kt b/app/src/main/java/io/github/wulkanowy/ui/base/WidgetConfigureAdapter.kt
index 8e6130fb..cefe6ed7 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/base/WidgetConfigureAdapter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/base/WidgetConfigureAdapter.kt
@@ -9,7 +9,6 @@ import io.github.wulkanowy.R
import io.github.wulkanowy.data.db.entities.Student
import io.github.wulkanowy.databinding.ItemAccountBinding
import io.github.wulkanowy.utils.getThemeAttrColor
-import io.github.wulkanowy.utils.nickOrName
import javax.inject.Inject
class WidgetConfigureAdapter @Inject constructor() : RecyclerView.Adapter() {
@@ -29,7 +28,7 @@ class WidgetConfigureAdapter @Inject constructor() : RecyclerView.Adapter(R.layout.fragment_about
override val versionRes: Triple?
get() = context?.run {
- val buildTimestamp = appInfo.buildTimestamp.toLocalDateTime().toFormattedString("yyyy-MM-dd")
- val versionSignature = "${appInfo.versionName}-${appInfo.buildFlavor} (${appInfo.versionCode}), $buildTimestamp"
- Triple(getString(R.string.about_version), versionSignature, getCompatDrawable(R.drawable.ic_all_about))
+ Triple(getString(R.string.about_version), "${appInfo.versionName} (${appInfo.versionCode})", getCompatDrawable(R.drawable.ic_all_about))
}
override val creatorsRes: Triple?
@@ -62,18 +58,9 @@ class AboutFragment : BaseFragment(R.layout.fragment_about
Triple(getString(R.string.about_discord), getString(R.string.about_discord_summary), getCompatDrawable(R.drawable.ic_about_discord))
}
- override val facebookRes: Triple?
- get() = context?.run {
- Triple(getString(R.string.about_facebook), getString(R.string.about_facebook_summary), getCompatDrawable(R.drawable.ic_about_facebook))
- }
-
override val homepageRes: Triple?
get() = context?.run {
- Triple(
- getString(R.string.about_homepage),
- getString(R.string.about_homepage_summary),
- getCompatDrawable(R.drawable.ic_all_home)
- )
+ Triple(getString(R.string.about_homepage), getString(R.string.about_homepage_summary), getCompatDrawable(R.drawable.ic_about_homepage))
}
override val licensesRes: Triple?
@@ -126,10 +113,6 @@ class AboutFragment : BaseFragment(R.layout.fragment_about
context?.openInternetBrowser("https://discord.gg/vccAQBr", ::showMessage)
}
- override fun openFacebookPage() {
- context?.openInternetBrowser("https://www.facebook.com/wulkanowy", ::showMessage)
- }
-
override fun openHomepage() {
context?.openInternetBrowser("https://wulkanowy.github.io/", ::showMessage)
}
@@ -139,17 +122,11 @@ class AboutFragment : BaseFragment(R.layout.fragment_about
chooserTitle = getString(R.string.about_feedback),
email = "wulkanowyinc@gmail.com",
subject = "Zgłoszenie błędu",
- body = getString(
- R.string.about_feedback_template,
- "${appInfo.systemManufacturer} ${appInfo.systemModel}",
- appInfo.systemVersion.toString(),
- "${appInfo.versionName}-${appInfo.buildFlavor}"
+ body = getString(R.string.about_feedback_template,
+ "${appInfo.systemManufacturer} ${appInfo.systemModel}", appInfo.systemVersion.toString(), appInfo.versionName
),
onActivityNotFound = {
- requireContext().openInternetBrowser(
- "https://github.com/wulkanowy/wulkanowy/issues",
- ::showMessage
- )
+ requireContext().openInternetBrowser("https://github.com/wulkanowy/wulkanowy/issues", ::showMessage)
}
)
}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/about/AboutPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/about/AboutPresenter.kt
index fde20267..24e59d36 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/about/AboutPresenter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/about/AboutPresenter.kt
@@ -1,10 +1,10 @@
package io.github.wulkanowy.ui.modules.about
-import io.github.wulkanowy.data.repositories.StudentRepository
+import io.github.wulkanowy.data.repositories.student.StudentRepository
import io.github.wulkanowy.ui.base.BasePresenter
import io.github.wulkanowy.ui.base.ErrorHandler
-import io.github.wulkanowy.utils.AnalyticsHelper
import io.github.wulkanowy.utils.AppInfo
+import io.github.wulkanowy.utils.FirebaseAnalyticsHelper
import timber.log.Timber
import javax.inject.Inject
@@ -12,7 +12,7 @@ class AboutPresenter @Inject constructor(
errorHandler: ErrorHandler,
studentRepository: StudentRepository,
private val appInfo: AppInfo,
- private val analytics: AnalyticsHelper
+ private val analytics: FirebaseAnalyticsHelper
) : BasePresenter(errorHandler, studentRepository) {
override fun onAttachView(view: AboutView) {
@@ -46,11 +46,6 @@ class AboutPresenter @Inject constructor(
openDiscordInvite()
analytics.logEvent("about_open", "name" to "discord")
}
- facebookRes?.first -> {
- Timber.i("Opening facebook")
- openFacebookPage()
- analytics.logEvent("about_open", "name" to "facebook")
- }
homepageRes?.first -> {
Timber.i("Opening homepage")
openHomepage()
@@ -83,7 +78,6 @@ class AboutPresenter @Inject constructor(
feedbackRes,
faqRes,
discordRes,
- facebookRes,
homepageRes,
licensesRes,
privacyRes
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/about/AboutView.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/about/AboutView.kt
index 54882b30..4c4b002f 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/about/AboutView.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/about/AboutView.kt
@@ -15,8 +15,6 @@ interface AboutView : BaseView {
val discordRes: Triple?
- val facebookRes: Triple?
-
val homepageRes: Triple?
val licensesRes: Triple?
@@ -33,8 +31,6 @@ interface AboutView : BaseView {
fun openDiscordInvite()
- fun openFacebookPage()
-
fun openEmailClient()
fun openFaqPage()
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/about/contributor/ContributorPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/about/contributor/ContributorPresenter.kt
index ef4b540e..78fdb43a 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/about/contributor/ContributorPresenter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/about/contributor/ContributorPresenter.kt
@@ -2,8 +2,8 @@ package io.github.wulkanowy.ui.modules.about.contributor
import io.github.wulkanowy.data.Status
import io.github.wulkanowy.data.pojos.Contributor
-import io.github.wulkanowy.data.repositories.AppCreatorRepository
-import io.github.wulkanowy.data.repositories.StudentRepository
+import io.github.wulkanowy.data.repositories.appcreator.AppCreatorRepository
+import io.github.wulkanowy.data.repositories.student.StudentRepository
import io.github.wulkanowy.ui.base.BasePresenter
import io.github.wulkanowy.ui.base.ErrorHandler
import io.github.wulkanowy.utils.flowWithResource
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/about/license/LicensePresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/about/license/LicensePresenter.kt
index cc430fc2..18d257ee 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/about/license/LicensePresenter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/about/license/LicensePresenter.kt
@@ -2,7 +2,7 @@ package io.github.wulkanowy.ui.modules.about.license
import com.mikepenz.aboutlibraries.entity.Library
import io.github.wulkanowy.data.Status
-import io.github.wulkanowy.data.repositories.StudentRepository
+import io.github.wulkanowy.data.repositories.student.StudentRepository
import io.github.wulkanowy.ui.base.BasePresenter
import io.github.wulkanowy.ui.base.ErrorHandler
import io.github.wulkanowy.utils.DispatchersProvider
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/about/logviewer/LogViewerPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/about/logviewer/LogViewerPresenter.kt
index 80020c81..85eae8e6 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/about/logviewer/LogViewerPresenter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/about/logviewer/LogViewerPresenter.kt
@@ -1,8 +1,8 @@
package io.github.wulkanowy.ui.modules.about.logviewer
import io.github.wulkanowy.data.Status
-import io.github.wulkanowy.data.repositories.LoggerRepository
-import io.github.wulkanowy.data.repositories.StudentRepository
+import io.github.wulkanowy.data.repositories.logger.LoggerRepository
+import io.github.wulkanowy.data.repositories.student.StudentRepository
import io.github.wulkanowy.ui.base.BasePresenter
import io.github.wulkanowy.ui.base.ErrorHandler
import io.github.wulkanowy.utils.flowWithResource
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/account/AccountAdapter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/account/AccountAdapter.kt
index 342fd2d4..7ecb4139 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/account/AccountAdapter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/account/AccountAdapter.kt
@@ -8,17 +8,16 @@ import android.view.View.VISIBLE
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import io.github.wulkanowy.R
+import io.github.wulkanowy.data.db.entities.Student
import io.github.wulkanowy.data.db.entities.StudentWithSemesters
import io.github.wulkanowy.databinding.HeaderAccountBinding
import io.github.wulkanowy.databinding.ItemAccountBinding
+import io.github.wulkanowy.sdk.Sdk
import io.github.wulkanowy.utils.getThemeAttrColor
-import io.github.wulkanowy.utils.nickOrName
import javax.inject.Inject
class AccountAdapter @Inject constructor() : RecyclerView.Adapter() {
- var isAccountQuickDialogMode = false
-
var items = emptyList>()
var onClickListener: (StudentWithSemesters) -> Unit = {}
@@ -31,69 +30,54 @@ class AccountAdapter @Inject constructor() : RecyclerView.Adapter HeaderViewHolder(
- HeaderAccountBinding.inflate(inflater, parent, false)
- )
- AccountItem.ViewType.ITEM.id -> ItemViewHolder(
- ItemAccountBinding.inflate(inflater, parent, false)
- )
+ AccountItem.ViewType.HEADER.id -> HeaderViewHolder(HeaderAccountBinding.inflate(inflater, parent, false))
+ AccountItem.ViewType.ITEM.id -> ItemViewHolder(ItemAccountBinding.inflate(inflater, parent, false))
else -> throw IllegalStateException()
}
}
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
when (holder) {
- is HeaderViewHolder -> bindHeaderViewHolder(
- holder.binding,
- items[position].value as Account,
- position
- )
- is ItemViewHolder -> bindItemViewHolder(
- holder.binding,
- items[position].value as StudentWithSemesters
- )
+ is HeaderViewHolder -> bindHeaderViewHolder(holder.binding, items[position].value as Account)
+ is ItemViewHolder -> bindItemViewHolder(holder.binding, items[position].value as StudentWithSemesters)
}
}
- private fun bindHeaderViewHolder(
- binding: HeaderAccountBinding,
- account: Account,
- position: Int
- ) {
+ private fun bindHeaderViewHolder(binding: HeaderAccountBinding, account: Account) {
with(binding) {
- accountHeaderDivider.visibility = if (position == 0) GONE else VISIBLE
accountHeaderEmail.text = account.email
accountHeaderType.setText(if (account.isParent) R.string.account_type_parent else R.string.account_type_student)
}
}
@SuppressLint("SetTextI18n")
- private fun bindItemViewHolder(
- binding: ItemAccountBinding,
- studentWithSemesters: StudentWithSemesters
- ) {
+ private fun bindItemViewHolder(binding: ItemAccountBinding, studentWithSemesters: StudentWithSemesters) {
val student = studentWithSemesters.student
val semesters = studentWithSemesters.semesters
val diary = semesters.maxByOrNull { it.semesterId }
- val isDuplicatedStudent = items.filter {
- if (it.value !is StudentWithSemesters) return@filter false
- val studentToCompare = it.value.student
-
- studentToCompare.studentId == student.studentId
- && studentToCompare.schoolSymbol == student.schoolSymbol
- && studentToCompare.symbol == student.symbol
- }.size > 1 && isAccountQuickDialogMode
with(binding) {
- accountItemName.text = "${student.nickOrName} ${diary?.diaryName.orEmpty()}"
+ accountItemName.text = "${student.studentName} ${diary?.diaryName.orEmpty()}"
accountItemSchool.text = studentWithSemesters.student.schoolName
- accountItemAccountType.setText(if (student.isParent) R.string.account_type_parent else R.string.account_type_student)
- accountItemAccountType.visibility = if (isDuplicatedStudent) VISIBLE else GONE
+ with(accountItemLoginMode) {
+ visibility = when (Sdk.Mode.valueOf(student.loginMode)) {
+ Sdk.Mode.API -> {
+ setText(R.string.account_login_mobile_api)
+ VISIBLE
+ }
+ Sdk.Mode.HYBRID -> {
+ setText(R.string.account_login_hybrid)
+ VISIBLE
+ }
+ Sdk.Mode.SCRAPPER -> {
+ GONE
+ }
+ }
+ }
with(accountItemImage) {
- val colorImage =
- if (student.isCurrent) context.getThemeAttrColor(R.attr.colorPrimary)
- else context.getThemeAttrColor(R.attr.colorOnSurface, 153)
+ val colorImage = if (student.isCurrent) context.getThemeAttrColor(R.attr.colorPrimary)
+ else context.getThemeAttrColor(R.attr.colorOnSurface, 153)
setColorFilter(colorImage, PorterDuff.Mode.SRC_IN)
}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/account/AccountDialog.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/account/AccountDialog.kt
new file mode 100644
index 00000000..1fa87268
--- /dev/null
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/account/AccountDialog.kt
@@ -0,0 +1,102 @@
+package io.github.wulkanowy.ui.modules.account
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.Toast
+import android.widget.Toast.LENGTH_LONG
+import androidx.appcompat.app.AlertDialog
+import androidx.recyclerview.widget.LinearLayoutManager
+import dagger.hilt.android.AndroidEntryPoint
+import io.github.wulkanowy.R
+import io.github.wulkanowy.databinding.DialogAccountBinding
+import io.github.wulkanowy.ui.base.BaseDialogFragment
+import io.github.wulkanowy.ui.modules.login.LoginActivity
+import javax.inject.Inject
+
+@AndroidEntryPoint
+class AccountDialog : BaseDialogFragment(), AccountView {
+
+ @Inject
+ lateinit var presenter: AccountPresenter
+
+ @Inject
+ lateinit var accountAdapter: AccountAdapter
+
+ companion object {
+ fun newInstance() = AccountDialog()
+ }
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setStyle(STYLE_NO_TITLE, 0)
+ }
+
+ override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
+ return DialogAccountBinding.inflate(inflater).apply { binding = this }.root
+ }
+
+ override fun onActivityCreated(savedInstanceState: Bundle?) {
+ super.onActivityCreated(savedInstanceState)
+ presenter.onAttachView(this)
+ }
+
+ override fun initView() {
+ accountAdapter.onClickListener = presenter::onItemSelected
+
+ with(binding) {
+ accountDialogAdd.setOnClickListener { presenter.onAddSelected() }
+ accountDialogRemove.setOnClickListener { presenter.onRemoveSelected() }
+ accountDialogRecycler.apply {
+ layoutManager = LinearLayoutManager(context)
+ adapter = accountAdapter
+ }
+ }
+ }
+
+ override fun updateData(data: List>) {
+ with(accountAdapter) {
+ items = data
+ notifyDataSetChanged()
+ }
+ }
+
+ override fun showError(text: String, error: Throwable) {
+ showMessage(text)
+ }
+
+ override fun showMessage(text: String) {
+ Toast.makeText(context, text, LENGTH_LONG).show()
+ }
+
+ override fun dismissView() {
+ dismiss()
+ }
+
+ override fun openLoginView() {
+ activity?.let {
+ startActivity(LoginActivity.getStartIntent(it))
+ }
+ }
+
+ override fun showConfirmDialog() {
+ context?.let {
+ AlertDialog.Builder(it)
+ .setTitle(R.string.account_logout_student)
+ .setMessage(R.string.account_confirm)
+ .setPositiveButton(R.string.account_logout) { _, _ -> presenter.onLogoutConfirm() }
+ .setNegativeButton(android.R.string.cancel) { _, _ -> }
+ .show()
+ }
+ }
+
+ override fun recreateMainView() {
+ activity?.recreate()
+ }
+
+ override fun onDestroy() {
+ presenter.onDetachView()
+ super.onDestroy()
+ }
+}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/account/AccountFragment.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/account/AccountFragment.kt
deleted file mode 100644
index 7293527e..00000000
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/account/AccountFragment.kt
+++ /dev/null
@@ -1,111 +0,0 @@
-package io.github.wulkanowy.ui.modules.account
-
-import android.os.Bundle
-import android.view.Menu
-import android.view.MenuInflater
-import android.view.View
-import androidx.core.view.get
-import androidx.recyclerview.widget.LinearLayoutManager
-import dagger.hilt.android.AndroidEntryPoint
-import io.github.wulkanowy.R
-import io.github.wulkanowy.data.db.entities.StudentWithSemesters
-import io.github.wulkanowy.databinding.FragmentAccountBinding
-import io.github.wulkanowy.ui.base.BaseFragment
-import io.github.wulkanowy.ui.modules.account.accountdetails.AccountDetailsFragment
-import io.github.wulkanowy.ui.modules.login.LoginActivity
-import io.github.wulkanowy.ui.modules.main.MainActivity
-import io.github.wulkanowy.ui.modules.main.MainView
-import javax.inject.Inject
-
-@AndroidEntryPoint
-class AccountFragment : BaseFragment(R.layout.fragment_account),
- AccountView, MainView.TitledView {
-
- @Inject
- lateinit var presenter: AccountPresenter
-
- @Inject
- lateinit var accountAdapter: AccountAdapter
-
- companion object {
-
- fun newInstance() = AccountFragment()
- }
-
- override val titleStringId = R.string.account_title
-
- override var subtitleString = ""
-
- override val isViewEmpty get() = accountAdapter.items.isEmpty()
-
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setHasOptionsMenu(true)
- }
-
- override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
- super.onViewCreated(view, savedInstanceState)
- binding = FragmentAccountBinding.bind(view)
- presenter.onAttachView(this)
- }
-
- override fun initView() {
- binding.accountErrorRetry.setOnClickListener { presenter.onRetry() }
- binding.accountErrorDetails.setOnClickListener { presenter.onDetailsClick() }
-
- binding.accountRecycler.apply {
- layoutManager = LinearLayoutManager(context)
- adapter = accountAdapter
- }
-
- accountAdapter.onClickListener = presenter::onItemSelected
-
- with(binding) {
- accountAdd.setOnClickListener { presenter.onAddSelected() }
- }
- }
-
- override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
- menu[0].isVisible = false
- }
-
- override fun updateData(data: List>) {
- with(accountAdapter) {
- items = data
- notifyDataSetChanged()
- }
- }
-
- override fun openLoginView() {
- activity?.let {
- startActivity(LoginActivity.getStartIntent(it))
- }
- }
-
- override fun openAccountDetailsView(studentWithSemesters: StudentWithSemesters) {
- (activity as? MainActivity)?.pushView(
- AccountDetailsFragment.newInstance(
- studentWithSemesters
- )
- )
- }
-
- override fun showErrorView(show: Boolean) {
- binding.accountError.visibility = if (show) View.VISIBLE else View.GONE
- }
-
- override fun setErrorDetails(message: String) {
- binding.accountErrorMessage.text = message
- }
-
- override fun showProgress(show: Boolean) {
- binding.accountProgress.visibility = if (show) View.VISIBLE else View.GONE
- }
-
- override fun showContent(show: Boolean) {
- with(binding) {
- accountRecycler.visibility = if (show) View.VISIBLE else View.GONE
- accountAdd.visibility = if (show) View.VISIBLE else View.GONE
- }
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/account/AccountPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/account/AccountPresenter.kt
index 366793b6..4eaee429 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/account/AccountPresenter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/account/AccountPresenter.kt
@@ -2,7 +2,8 @@ package io.github.wulkanowy.ui.modules.account
import io.github.wulkanowy.data.Status
import io.github.wulkanowy.data.db.entities.StudentWithSemesters
-import io.github.wulkanowy.data.repositories.StudentRepository
+import io.github.wulkanowy.data.repositories.student.StudentRepository
+import io.github.wulkanowy.services.sync.SyncManager
import io.github.wulkanowy.ui.base.BasePresenter
import io.github.wulkanowy.ui.base.ErrorHandler
import io.github.wulkanowy.utils.afterLoading
@@ -14,91 +15,101 @@ import javax.inject.Inject
class AccountPresenter @Inject constructor(
errorHandler: ErrorHandler,
studentRepository: StudentRepository,
+ private val syncManager: SyncManager
) : BasePresenter(errorHandler, studentRepository) {
- private lateinit var lastError: Throwable
-
override fun onAttachView(view: AccountView) {
super.onAttachView(view)
view.initView()
- Timber.i("Account view was initialized")
- errorHandler.showErrorMessage = ::showErrorViewOnError
+ Timber.i("Account dialog view was initialized")
loadData()
}
- fun onRetry() {
- view?.run {
- showErrorView(false)
- showProgress(true)
- }
- loadData()
- }
-
- fun onDetailsClick() {
- view?.showErrorDetailsDialog(lastError)
- }
-
fun onAddSelected() {
Timber.i("Select add account")
view?.openLoginView()
}
+ fun onRemoveSelected() {
+ Timber.i("Select remove account")
+ view?.showConfirmDialog()
+ }
+
+ fun onLogoutConfirm() {
+ flowWithResource {
+ val student = studentRepository.getCurrentStudent(false)
+ studentRepository.logoutStudent(student)
+
+ val students = studentRepository.getSavedStudents(false)
+ if (students.isNotEmpty()) {
+ studentRepository.switchStudent(students[0])
+ }
+ students
+ }.onEach {
+ when (it.status) {
+ Status.LOADING -> Timber.i("Attempt to logout current user ")
+ Status.SUCCESS -> view?.run {
+ if (it.data!!.isEmpty()) {
+ Timber.i("Logout result: Open login view")
+ syncManager.stopSyncWorker()
+ openClearLoginView()
+ } else {
+ Timber.i("Logout result: Switch to another student")
+ recreateMainView()
+ }
+ }
+ Status.ERROR -> {
+ Timber.i("Logout result: An exception occurred")
+ errorHandler.dispatch(it.error!!)
+ }
+ }
+ }.afterLoading {
+ view?.dismissView()
+ }.launch("logout")
+ }
+
fun onItemSelected(studentWithSemesters: StudentWithSemesters) {
- view?.openAccountDetailsView(studentWithSemesters)
+ Timber.i("Select student item ${studentWithSemesters.student.id}")
+ if (studentWithSemesters.student.isCurrent) {
+ view?.dismissView()
+ } else flowWithResource { studentRepository.switchStudent(studentWithSemesters) }.onEach {
+ when (it.status) {
+ Status.LOADING -> Timber.i("Attempt to change a student")
+ Status.SUCCESS -> {
+ Timber.i("Change a student result: Success")
+ view?.recreateMainView()
+ }
+ Status.ERROR -> {
+ Timber.i("Change a student result: An exception occurred")
+ errorHandler.dispatch(it.error!!)
+ }
+ }
+ }.afterLoading {
+ view?.dismissView()
+ }.launch("switch")
}
private fun createAccountItems(items: List): List> {
- return items.groupBy {
- Account("${it.student.userName} (${it.student.email})", it.student.isParent)
- }
- .map { (account, students) ->
- listOf(
- AccountItem(account, AccountItem.ViewType.HEADER)
- ) + students.map { student ->
- AccountItem(student, AccountItem.ViewType.ITEM)
- }
+ return items.groupBy { Account(it.student.email, it.student.isParent) }.map { (account, students) ->
+ listOf(AccountItem(account, AccountItem.ViewType.HEADER)) + students.map { student ->
+ AccountItem(student, AccountItem.ViewType.ITEM)
}
- .flatten()
+ }.flatten()
}
private fun loadData() {
- flowWithResource { studentRepository.getSavedStudents(false) }
- .onEach {
- when (it.status) {
- Status.LOADING -> {
- Timber.i("Loading account data started")
- view?.run {
- showProgress(true)
- showContent(false)
- }
- }
- Status.SUCCESS -> {
- Timber.i("Loading account result: Success")
- view?.updateData(createAccountItems(it.data!!))
- view?.run {
- showContent(true)
- showErrorView(false)
- }
- }
- Status.ERROR -> {
- Timber.i("Loading account result: An exception occurred")
- errorHandler.dispatch(it.error!!)
- }
+ flowWithResource { studentRepository.getSavedStudents(false) }.onEach {
+ when (it.status) {
+ Status.LOADING -> Timber.i("Loading account data started")
+ Status.SUCCESS -> {
+ Timber.i("Loading account result: Success")
+ view?.updateData(createAccountItems(it.data!!))
+ }
+ Status.ERROR -> {
+ Timber.i("Loading account result: An exception occurred")
+ errorHandler.dispatch(it.error!!)
}
}
- .afterLoading { view?.showProgress(false) }
- .launch()
- }
-
- private fun showErrorViewOnError(message: String, error: Throwable) {
- view?.run {
- if (isViewEmpty) {
- lastError = error
- setErrorDetails(message)
- showErrorView(true)
- showContent(false)
- showProgress(false)
- } else showError(message, error)
- }
+ }.launch()
}
}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/account/AccountView.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/account/AccountView.kt
index 3453909d..a1f8086c 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/account/AccountView.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/account/AccountView.kt
@@ -1,26 +1,19 @@
package io.github.wulkanowy.ui.modules.account
-import io.github.wulkanowy.data.db.entities.StudentWithSemesters
import io.github.wulkanowy.ui.base.BaseView
interface AccountView : BaseView {
- val isViewEmpty: Boolean
-
fun initView()
fun updateData(data: List>)
+ fun dismissView()
+
+ fun showConfirmDialog()
+
fun openLoginView()
- fun openAccountDetailsView(studentWithSemesters: StudentWithSemesters)
-
- fun showErrorView(show: Boolean)
-
- fun setErrorDetails(message: String)
-
- fun showProgress(show: Boolean)
-
- fun showContent(show: Boolean)
+ fun recreateMainView()
}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/account/accountdetails/AccountDetailsFragment.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/account/accountdetails/AccountDetailsFragment.kt
deleted file mode 100644
index f4b2c833..00000000
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/account/accountdetails/AccountDetailsFragment.kt
+++ /dev/null
@@ -1,157 +0,0 @@
-package io.github.wulkanowy.ui.modules.account.accountdetails
-
-import android.os.Bundle
-import android.view.Menu
-import android.view.MenuInflater
-import android.view.MenuItem
-import android.view.View
-import androidx.appcompat.app.AlertDialog
-import androidx.core.view.get
-import dagger.hilt.android.AndroidEntryPoint
-import io.github.wulkanowy.R
-import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.data.db.entities.StudentWithSemesters
-import io.github.wulkanowy.databinding.FragmentAccountDetailsBinding
-import io.github.wulkanowy.ui.base.BaseFragment
-import io.github.wulkanowy.ui.modules.account.accountedit.AccountEditDialog
-import io.github.wulkanowy.ui.modules.main.MainActivity
-import io.github.wulkanowy.ui.modules.main.MainView
-import io.github.wulkanowy.ui.modules.studentinfo.StudentInfoFragment
-import io.github.wulkanowy.ui.modules.studentinfo.StudentInfoView
-import io.github.wulkanowy.utils.nickOrName
-import javax.inject.Inject
-
-@AndroidEntryPoint
-class AccountDetailsFragment :
- BaseFragment(R.layout.fragment_account_details),
- AccountDetailsView, MainView.TitledView {
-
- @Inject
- lateinit var presenter: AccountDetailsPresenter
-
- override val titleStringId = R.string.account_details_title
-
- override var subtitleString = ""
-
- companion object {
-
- private const val ARGUMENT_KEY = "Data"
-
- fun newInstance(studentWithSemesters: StudentWithSemesters) =
- AccountDetailsFragment().apply {
- arguments = Bundle().apply { putSerializable(ARGUMENT_KEY, studentWithSemesters) }
- }
- }
-
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setHasOptionsMenu(true)
- }
-
- override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
- super.onViewCreated(view, savedInstanceState)
- binding = FragmentAccountDetailsBinding.bind(view)
- presenter.onAttachView(this, requireArguments()[ARGUMENT_KEY] as StudentWithSemesters)
- }
-
- override fun initView() {
- binding.accountDetailsErrorRetry.setOnClickListener { presenter.onRetry() }
- binding.accountDetailsErrorDetails.setOnClickListener { presenter.onDetailsClick() }
- binding.accountDetailsLogout.setOnClickListener { presenter.onRemoveSelected() }
- binding.accountDetailsSelect.setOnClickListener { presenter.onStudentSelect() }
-
- binding.accountDetailsPersonalData.setOnClickListener {
- presenter.onStudentInfoSelected(StudentInfoView.Type.PERSONAL)
- }
- binding.accountDetailsAddressData.setOnClickListener {
- presenter.onStudentInfoSelected(StudentInfoView.Type.ADDRESS)
- }
- binding.accountDetailsContactData.setOnClickListener {
- presenter.onStudentInfoSelected(StudentInfoView.Type.CONTACT)
- }
- binding.accountDetailsFamilyData.setOnClickListener {
- presenter.onStudentInfoSelected(StudentInfoView.Type.FAMILY)
- }
- }
-
- override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
- menu[0].isVisible = false
- inflater.inflate(R.menu.action_menu_account_details, menu)
- }
-
- override fun onOptionsItemSelected(item: MenuItem): Boolean {
- return if (item.itemId == R.id.accountDetailsMenuEdit) {
- presenter.onAccountEditSelected()
- true
- } else false
- }
-
- override fun showAccountData(student: Student) {
- with(binding) {
- accountDetailsName.text = student.nickOrName
- accountDetailsSchool.text = student.schoolName
- }
- }
-
- override fun enableSelectStudentButton(enable: Boolean) {
- binding.accountDetailsSelect.isEnabled = enable
- }
-
- override fun showAccountEditDetailsDialog(student: Student) {
- (requireActivity() as MainActivity).showDialogFragment(
- AccountEditDialog.newInstance(student)
- )
- }
-
- override fun showLogoutConfirmDialog() {
- context?.let {
- AlertDialog.Builder(it)
- .setTitle(R.string.account_logout_student)
- .setMessage(R.string.account_confirm)
- .setPositiveButton(R.string.account_logout) { _, _ -> presenter.onLogoutConfirm() }
- .setNegativeButton(android.R.string.cancel) { _, _ -> }
- .show()
- }
- }
-
- override fun popView() {
- (requireActivity() as MainActivity).popView(2)
- }
-
- override fun recreateMainView() {
- requireActivity().recreate()
- }
-
- override fun openStudentInfoView(
- infoType: StudentInfoView.Type,
- studentWithSemesters: StudentWithSemesters
- ) {
- (requireActivity() as MainActivity).pushView(
- StudentInfoFragment.newInstance(
- infoType,
- studentWithSemesters
- )
- )
- }
-
- override fun showErrorView(show: Boolean) {
- binding.accountDetailsError.visibility = if (show) View.VISIBLE else View.GONE
- }
-
- override fun setErrorDetails(message: String) {
- binding.accountDetailsErrorMessage.text = message
- }
-
- override fun showProgress(show: Boolean) {
- binding.accountDetailsProgress.visibility = if (show) View.VISIBLE else View.GONE
- }
-
- override fun showContent(show: Boolean) {
- binding.accountDetailsContent.visibility = if (show) View.VISIBLE else View.GONE
- }
-
- override fun onDestroyView() {
- presenter.onDetachView()
- super.onDestroyView()
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/account/accountdetails/AccountDetailsPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/account/accountdetails/AccountDetailsPresenter.kt
deleted file mode 100644
index 7b93d3d8..00000000
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/account/accountdetails/AccountDetailsPresenter.kt
+++ /dev/null
@@ -1,172 +0,0 @@
-package io.github.wulkanowy.ui.modules.account.accountdetails
-
-import io.github.wulkanowy.data.Resource
-import io.github.wulkanowy.data.Status
-import io.github.wulkanowy.data.db.entities.StudentWithSemesters
-import io.github.wulkanowy.data.repositories.StudentRepository
-import io.github.wulkanowy.services.sync.SyncManager
-import io.github.wulkanowy.ui.base.BasePresenter
-import io.github.wulkanowy.ui.base.ErrorHandler
-import io.github.wulkanowy.ui.modules.studentinfo.StudentInfoView
-import io.github.wulkanowy.utils.afterLoading
-import io.github.wulkanowy.utils.flowWithResource
-import kotlinx.coroutines.flow.map
-import kotlinx.coroutines.flow.onEach
-import timber.log.Timber
-import javax.inject.Inject
-
-class AccountDetailsPresenter @Inject constructor(
- errorHandler: ErrorHandler,
- studentRepository: StudentRepository,
- private val syncManager: SyncManager
-) : BasePresenter(errorHandler, studentRepository) {
-
- private lateinit var studentWithSemesters: StudentWithSemesters
-
- private lateinit var lastError: Throwable
-
- private var studentId: Long? = null
-
- fun onAttachView(view: AccountDetailsView, studentWithSemesters: StudentWithSemesters) {
- super.onAttachView(view)
- studentId = studentWithSemesters.student.id
-
- view.initView()
- errorHandler.showErrorMessage = ::showErrorViewOnError
- Timber.i("Account details view was initialized")
- loadData()
- }
-
- fun onRetry() {
- view?.run {
- showErrorView(false)
- showProgress(true)
- }
- loadData()
- }
-
- fun onDetailsClick() {
- view?.showErrorDetailsDialog(lastError)
- }
-
- private fun loadData() {
- flowWithResource { studentRepository.getSavedStudents() }
- .map { studentWithSemesters ->
- Resource(
- data = studentWithSemesters.data?.single { it.student.id == studentId },
- status = studentWithSemesters.status,
- error = studentWithSemesters.error
- )
- }
- .onEach {
- when (it.status) {
- Status.LOADING -> {
- view?.run {
- showProgress(true)
- showContent(false)
- }
- Timber.i("Loading account details view started")
- }
- Status.SUCCESS -> {
- Timber.i("Loading account details view result: Success")
- studentWithSemesters = it.data!!
- view?.run {
- showAccountData(studentWithSemesters.student)
- enableSelectStudentButton(!studentWithSemesters.student.isCurrent)
- showContent(true)
- showErrorView(false)
- }
- }
- Status.ERROR -> {
- Timber.i("Loading account details view result: An exception occurred")
- errorHandler.dispatch(it.error!!)
- }
- }
- }
- .afterLoading { view?.showProgress(false) }
- .launch()
- }
-
- fun onAccountEditSelected() {
- view?.showAccountEditDetailsDialog(studentWithSemesters.student)
- }
-
- fun onStudentInfoSelected(infoType: StudentInfoView.Type) {
- view?.openStudentInfoView(infoType, studentWithSemesters)
- }
-
- fun onStudentSelect() {
- Timber.i("Select student ${studentWithSemesters.student.id}")
-
- flowWithResource { studentRepository.switchStudent(studentWithSemesters) }
- .onEach {
- when (it.status) {
- Status.LOADING -> Timber.i("Attempt to change a student")
- Status.SUCCESS -> {
- Timber.i("Change a student result: Success")
- view?.recreateMainView()
- }
- Status.ERROR -> {
- Timber.i("Change a student result: An exception occurred")
- errorHandler.dispatch(it.error!!)
- }
- }
- }.afterLoading {
- view?.popView()
- }.launch("switch")
- }
-
- fun onRemoveSelected() {
- Timber.i("Select remove account")
- view?.showLogoutConfirmDialog()
- }
-
- fun onLogoutConfirm() {
- flowWithResource {
- val studentToLogout = studentWithSemesters.student
-
- studentRepository.logoutStudent(studentToLogout)
- val students = studentRepository.getSavedStudents(false)
-
- if (studentToLogout.isCurrent && students.isNotEmpty()) {
- studentRepository.switchStudent(students[0])
- }
-
- return@flowWithResource students
- }.onEach {
- when (it.status) {
- Status.LOADING -> Timber.i("Attempt to logout user")
- Status.SUCCESS -> view?.run {
- when {
- it.data!!.isEmpty() -> {
- Timber.i("Logout result: Open login view")
- syncManager.stopSyncWorker()
- openClearLoginView()
- }
- studentWithSemesters.student.isCurrent -> {
- Timber.i("Logout result: Logout student and switch to another")
- recreateMainView()
- }
- else -> Timber.i("Logout result: Logout student")
- }
- }
- Status.ERROR -> {
- Timber.i("Logout result: An exception occurred")
- errorHandler.dispatch(it.error!!)
- }
- }
- }.afterLoading {
- view?.popView()
- }.launch("logout")
- }
-
- private fun showErrorViewOnError(message: String, error: Throwable) {
- view?.run {
- lastError = error
- setErrorDetails(message)
- showErrorView(true)
- showContent(false)
- showProgress(false)
- }
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/account/accountdetails/AccountDetailsView.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/account/accountdetails/AccountDetailsView.kt
deleted file mode 100644
index 652f0c1a..00000000
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/account/accountdetails/AccountDetailsView.kt
+++ /dev/null
@@ -1,36 +0,0 @@
-package io.github.wulkanowy.ui.modules.account.accountdetails
-
-import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.data.db.entities.StudentWithSemesters
-import io.github.wulkanowy.ui.base.BaseView
-import io.github.wulkanowy.ui.modules.studentinfo.StudentInfoView
-
-interface AccountDetailsView : BaseView {
-
- fun initView()
-
- fun showAccountData(student: Student)
-
- fun showAccountEditDetailsDialog(student: Student)
-
- fun showLogoutConfirmDialog()
-
- fun popView()
-
- fun recreateMainView()
-
- fun enableSelectStudentButton(enable: Boolean)
-
- fun openStudentInfoView(
- infoType: StudentInfoView.Type,
- studentWithSemesters: StudentWithSemesters
- )
-
- fun showErrorView(show: Boolean)
-
- fun setErrorDetails(message: String)
-
- fun showProgress(show: Boolean)
-
- fun showContent(show: Boolean)
-}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/account/accountedit/AccountEditDialog.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/account/accountedit/AccountEditDialog.kt
deleted file mode 100644
index 89f23e29..00000000
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/account/accountedit/AccountEditDialog.kt
+++ /dev/null
@@ -1,72 +0,0 @@
-package io.github.wulkanowy.ui.modules.account.accountedit
-
-import android.os.Bundle
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import dagger.hilt.android.AndroidEntryPoint
-import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.databinding.DialogAccountEditBinding
-import io.github.wulkanowy.ui.base.BaseDialogFragment
-import javax.inject.Inject
-
-@AndroidEntryPoint
-class AccountEditDialog : BaseDialogFragment(), AccountEditView {
-
- @Inject
- lateinit var presenter: AccountEditPresenter
-
- companion object {
-
- private const val ARGUMENT_KEY = "student_with_semesters"
-
- fun newInstance(student: Student) =
- AccountEditDialog().apply {
- arguments = Bundle().apply {
- putSerializable(ARGUMENT_KEY, student)
- }
- }
- }
-
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setStyle(STYLE_NO_TITLE, 0)
- }
-
- override fun onCreateView(
- inflater: LayoutInflater,
- container: ViewGroup?,
- savedInstanceState: Bundle?
- ): View = DialogAccountEditBinding.inflate(inflater).apply { binding = this }.root
-
- override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
- super.onViewCreated(view, savedInstanceState)
- presenter.onAttachView(this, requireArguments()[ARGUMENT_KEY] as Student)
- }
-
- override fun initView() {
- with(binding) {
- accountEditDetailsCancel.setOnClickListener { dismiss() }
- accountEditDetailsSave.setOnClickListener {
- presenter.changeStudentNick(binding.accountEditDetailsNickText.text.toString())
- }
- }
- }
-
- override fun showCurrentNick(nick: String) {
- binding.accountEditDetailsNickText.setText(nick)
- }
-
- override fun popView() {
- dismiss()
- }
-
- override fun recreateMainView() {
- activity?.recreate()
- }
-
- override fun onDestroyView() {
- super.onDestroyView()
- presenter.onDetachView()
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/account/accountedit/AccountEditPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/account/accountedit/AccountEditPresenter.kt
deleted file mode 100644
index 7830605c..00000000
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/account/accountedit/AccountEditPresenter.kt
+++ /dev/null
@@ -1,54 +0,0 @@
-package io.github.wulkanowy.ui.modules.account.accountedit
-
-import io.github.wulkanowy.data.Status
-import io.github.wulkanowy.data.db.entities.Student
-import io.github.wulkanowy.data.db.entities.StudentNick
-import io.github.wulkanowy.data.repositories.StudentRepository
-import io.github.wulkanowy.ui.base.BasePresenter
-import io.github.wulkanowy.ui.base.ErrorHandler
-import io.github.wulkanowy.utils.afterLoading
-import io.github.wulkanowy.utils.flowWithResource
-import kotlinx.coroutines.flow.onEach
-import timber.log.Timber
-import javax.inject.Inject
-
-class AccountEditPresenter @Inject constructor(
- errorHandler: ErrorHandler,
- studentRepository: StudentRepository
-) : BasePresenter(errorHandler, studentRepository) {
-
- lateinit var student: Student
-
- fun onAttachView(view: AccountEditView, student: Student) {
- super.onAttachView(view)
- this.student = student
-
- with(view) {
- initView()
- showCurrentNick(student.nick.trim())
- }
- Timber.i("Account edit dialog view was initialized")
- }
-
- fun changeStudentNick(nick: String) {
- flowWithResource {
- val studentNick =
- StudentNick(nick = nick.trim()).apply { id = student.id }
- studentRepository.updateStudentNick(studentNick)
- }.onEach {
- when (it.status) {
- Status.LOADING -> Timber.i("Attempt to change a student nick")
- Status.SUCCESS -> {
- Timber.i("Change a student nick result: Success")
- view?.recreateMainView()
- }
- Status.ERROR -> {
- Timber.i("Change a student result: An exception occurred")
- errorHandler.dispatch(it.error!!)
- }
- }
- }
- .afterLoading { view?.popView() }
- .launch()
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/account/accountedit/AccountEditView.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/account/accountedit/AccountEditView.kt
deleted file mode 100644
index b25eec6c..00000000
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/account/accountedit/AccountEditView.kt
+++ /dev/null
@@ -1,14 +0,0 @@
-package io.github.wulkanowy.ui.modules.account.accountedit
-
-import io.github.wulkanowy.ui.base.BaseView
-
-interface AccountEditView : BaseView {
-
- fun initView()
-
- fun popView()
-
- fun recreateMainView()
-
- fun showCurrentNick(nick: String)
-}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/account/accountquick/AccountQuickDialog.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/account/accountquick/AccountQuickDialog.kt
deleted file mode 100644
index cb64a8fd..00000000
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/account/accountquick/AccountQuickDialog.kt
+++ /dev/null
@@ -1,82 +0,0 @@
-package io.github.wulkanowy.ui.modules.account.accountquick
-
-import android.os.Bundle
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import androidx.recyclerview.widget.LinearLayoutManager
-import dagger.hilt.android.AndroidEntryPoint
-import io.github.wulkanowy.databinding.DialogAccountQuickBinding
-import io.github.wulkanowy.ui.base.BaseDialogFragment
-import io.github.wulkanowy.ui.modules.account.AccountAdapter
-import io.github.wulkanowy.ui.modules.account.AccountFragment
-import io.github.wulkanowy.ui.modules.account.AccountItem
-import io.github.wulkanowy.ui.modules.main.MainActivity
-import javax.inject.Inject
-
-@AndroidEntryPoint
-class AccountQuickDialog : BaseDialogFragment(), AccountQuickView {
-
- @Inject
- lateinit var accountAdapter: AccountAdapter
-
- @Inject
- lateinit var presenter: AccountQuickPresenter
-
- companion object {
- fun newInstance() = AccountQuickDialog()
- }
-
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setStyle(STYLE_NO_TITLE, 0)
- }
-
- override fun onCreateView(
- inflater: LayoutInflater,
- container: ViewGroup?,
- savedInstanceState: Bundle?
- ) = DialogAccountQuickBinding.inflate(inflater).apply { binding = this }.root
-
- override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
- presenter.onAttachView(this)
- }
-
- override fun initView() {
- binding.accountQuickDialogManger.setOnClickListener { presenter.onManagerSelected() }
-
- with(accountAdapter) {
- isAccountQuickDialogMode = true
- onClickListener = presenter::onStudentSelect
- }
-
- with(binding.accountQuickDialogRecycler) {
- layoutManager = LinearLayoutManager(context)
- adapter = accountAdapter
- }
- }
-
- override fun updateData(data: List>) {
- with(accountAdapter) {
- items = data
- notifyDataSetChanged()
- }
- }
-
- override fun popView() {
- dismiss()
- }
-
- override fun recreateMainView() {
- activity?.recreate()
- }
-
- override fun openAccountView() {
- (requireActivity() as MainActivity).pushView(AccountFragment.newInstance())
- }
-
- override fun onDestroyView() {
- presenter.onDetachView()
- super.onDestroyView()
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/account/accountquick/AccountQuickPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/account/accountquick/AccountQuickPresenter.kt
deleted file mode 100644
index 43cc8bc7..00000000
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/account/accountquick/AccountQuickPresenter.kt
+++ /dev/null
@@ -1,79 +0,0 @@
-package io.github.wulkanowy.ui.modules.account.accountquick
-
-import io.github.wulkanowy.data.Status
-import io.github.wulkanowy.data.db.entities.StudentWithSemesters
-import io.github.wulkanowy.data.repositories.StudentRepository
-import io.github.wulkanowy.ui.base.BasePresenter
-import io.github.wulkanowy.ui.base.ErrorHandler
-import io.github.wulkanowy.ui.modules.account.AccountItem
-import io.github.wulkanowy.utils.afterLoading
-import io.github.wulkanowy.utils.flowWithResource
-import kotlinx.coroutines.flow.onEach
-import timber.log.Timber
-import javax.inject.Inject
-
-class AccountQuickPresenter @Inject constructor(
- errorHandler: ErrorHandler,
- studentRepository: StudentRepository
-) : BasePresenter(errorHandler, studentRepository) {
-
- override fun onAttachView(view: AccountQuickView) {
- super.onAttachView(view)
- view.initView()
- Timber.i("Account quick dialog view was initialized")
- loadData()
- }
-
- fun onManagerSelected() {
- view?.run {
- openAccountView()
- popView()
- }
- }
-
- fun onStudentSelect(studentWithSemesters: StudentWithSemesters) {
- Timber.i("Select student ${studentWithSemesters.student.id}")
-
- if (studentWithSemesters.student.isCurrent) {
- view?.popView()
- return
- }
-
- flowWithResource { studentRepository.switchStudent(studentWithSemesters) }
- .onEach {
- when (it.status) {
- Status.LOADING -> Timber.i("Attempt to change a student")
- Status.SUCCESS -> {
- Timber.i("Change a student result: Success")
- view?.recreateMainView()
- }
- Status.ERROR -> {
- Timber.i("Change a student result: An exception occurred")
- errorHandler.dispatch(it.error!!)
- }
- }
- }
- .afterLoading { view?.popView() }
- .launch("switch")
- }
-
- private fun loadData() {
- flowWithResource { studentRepository.getSavedStudents(false) }.onEach {
- when (it.status) {
- Status.LOADING -> Timber.i("Loading account data started")
- Status.SUCCESS -> {
- Timber.i("Loading account result: Success")
- view?.updateData(createAccountItems(it.data!!))
- }
- Status.ERROR -> {
- Timber.i("Loading account result: An exception occurred")
- errorHandler.dispatch(it.error!!)
- }
- }
- }.launch()
- }
-
- private fun createAccountItems(items: List) = items.map {
- AccountItem(it, AccountItem.ViewType.ITEM)
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/account/accountquick/AccountQuickView.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/account/accountquick/AccountQuickView.kt
deleted file mode 100644
index 4a9420d9..00000000
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/account/accountquick/AccountQuickView.kt
+++ /dev/null
@@ -1,17 +0,0 @@
-package io.github.wulkanowy.ui.modules.account.accountquick
-
-import io.github.wulkanowy.ui.base.BaseView
-import io.github.wulkanowy.ui.modules.account.AccountItem
-
-interface AccountQuickView : BaseView {
-
- fun initView()
-
- fun updateData(data: List>)
-
- fun recreateMainView()
-
- fun popView()
-
- fun openAccountView()
-}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendanceAdapter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendanceAdapter.kt
index 03ec1c84..8e8a6149 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendanceAdapter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendanceAdapter.kt
@@ -7,7 +7,7 @@ import androidx.core.view.isVisible
import androidx.recyclerview.widget.RecyclerView
import io.github.wulkanowy.R
import io.github.wulkanowy.data.db.entities.Attendance
-import io.github.wulkanowy.data.enums.SentExcuseStatus
+import io.github.wulkanowy.data.repositories.attendance.SentExcuseStatus
import io.github.wulkanowy.databinding.ItemAttendanceBinding
import io.github.wulkanowy.utils.description
import javax.inject.Inject
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendanceFragment.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendanceFragment.kt
index 00d5aae8..c7caef06 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendanceFragment.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendanceFragment.kt
@@ -26,7 +26,6 @@ import io.github.wulkanowy.ui.modules.main.MainView
import io.github.wulkanowy.ui.widgets.DividerItemDecoration
import io.github.wulkanowy.utils.SchooldaysRangeLimiter
import io.github.wulkanowy.utils.dpToPx
-import io.github.wulkanowy.utils.getThemeAttrColor
import java.time.LocalDate
import javax.inject.Inject
@@ -61,7 +60,6 @@ class AttendanceFragment : BaseFragment(R.layout.frag
override val excuseActionMode: Boolean get() = attendanceAdapter.excuseActionMode
private var actionMode: ActionMode? = null
-
private val actionModeCallback = object : ActionMode.Callback {
override fun onCreateActionMode(mode: ActionMode, menu: Menu): Boolean {
val inflater = mode.menuInflater
@@ -113,8 +111,6 @@ class AttendanceFragment : BaseFragment(R.layout.frag
with(binding) {
attendanceSwipe.setOnRefreshListener(presenter::onSwipeRefresh)
- attendanceSwipe.setColorSchemeColors(requireContext().getThemeAttrColor(R.attr.colorPrimary))
- attendanceSwipe.setProgressBackgroundColorSchemeColor(requireContext().getThemeAttrColor(R.attr.colorSwipeRefresh))
attendanceErrorRetry.setOnClickListener { presenter.onRetry() }
attendanceErrorDetails.setOnClickListener { presenter.onDetailsClick() }
@@ -195,8 +191,8 @@ class AttendanceFragment : BaseFragment(R.layout.frag
binding. attendanceRecycler.visibility = if (show) VISIBLE else GONE
}
- override fun showRefresh(show: Boolean) {
- binding.attendanceSwipe.isRefreshing = show
+ override fun hideRefresh() {
+ binding.attendanceSwipe.isRefreshing = false
}
override fun showPreButton(show: Boolean) {
@@ -226,7 +222,6 @@ class AttendanceFragment : BaseFragment(R.layout.frag
setDateRangeLimiter(SchooldaysRangeLimiter())
version = DatePickerDialog.Version.VERSION_2
scrollOrientation = DatePickerDialog.ScrollOrientation.VERTICAL
- vibrate(false)
show(this@AttendanceFragment.parentFragmentManager, null)
}
}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendancePresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendancePresenter.kt
index 68802c0c..158f08ba 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendancePresenter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendancePresenter.kt
@@ -3,13 +3,13 @@ package io.github.wulkanowy.ui.modules.attendance
import android.annotation.SuppressLint
import io.github.wulkanowy.data.Status
import io.github.wulkanowy.data.db.entities.Attendance
-import io.github.wulkanowy.data.repositories.AttendanceRepository
-import io.github.wulkanowy.data.repositories.PreferencesRepository
-import io.github.wulkanowy.data.repositories.SemesterRepository
-import io.github.wulkanowy.data.repositories.StudentRepository
+import io.github.wulkanowy.data.repositories.attendance.AttendanceRepository
+import io.github.wulkanowy.data.repositories.preferences.PreferencesRepository
+import io.github.wulkanowy.data.repositories.semester.SemesterRepository
+import io.github.wulkanowy.data.repositories.student.StudentRepository
import io.github.wulkanowy.ui.base.BasePresenter
import io.github.wulkanowy.ui.base.ErrorHandler
-import io.github.wulkanowy.utils.AnalyticsHelper
+import io.github.wulkanowy.utils.FirebaseAnalyticsHelper
import io.github.wulkanowy.utils.afterLoading
import io.github.wulkanowy.utils.flowWithResource
import io.github.wulkanowy.utils.flowWithResourceIn
@@ -34,7 +34,7 @@ class AttendancePresenter @Inject constructor(
private val attendanceRepository: AttendanceRepository,
private val semesterRepository: SemesterRepository,
private val prefRepository: PreferencesRepository,
- private val analytics: AnalyticsHelper
+ private val analytics: FirebaseAnalyticsHelper
) : BasePresenter(errorHandler, studentRepository) {
private var baseDate: LocalDate = now().previousOrSameSchoolDay
@@ -51,23 +51,23 @@ class AttendancePresenter @Inject constructor(
view.initView()
Timber.i("Attendance view was initialized")
errorHandler.showErrorMessage = ::showErrorViewOnError
- reloadView(ofEpochDay(date ?: baseDate.toEpochDay()))
- loadData()
+ loadData(ofEpochDay(date ?: baseDate.toEpochDay()))
if (currentDate.isHolidays) setBaseDateOnHolidays()
+ reloadView()
}
fun onPreviousDay() {
view?.finishActionMode()
attendanceToExcuseList.clear()
- reloadView(currentDate.previousSchoolDay)
- loadData()
+ loadData(currentDate.previousSchoolDay)
+ reloadView()
}
fun onNextDay() {
view?.finishActionMode()
attendanceToExcuseList.clear()
- reloadView(currentDate.nextSchoolDay)
- loadData()
+ loadData(currentDate.nextSchoolDay)
+ reloadView()
}
fun onPickDate() {
@@ -75,13 +75,13 @@ class AttendancePresenter @Inject constructor(
}
fun onDateSet(year: Int, month: Int, day: Int) {
- reloadView(LocalDate.of(year, month, day))
- loadData()
+ loadData(LocalDate.of(year, month, day))
+ reloadView()
}
fun onSwipeRefresh() {
Timber.i("Force refreshing the attendance")
- loadData(true)
+ loadData(currentDate, true)
}
fun onRetry() {
@@ -89,7 +89,7 @@ class AttendancePresenter @Inject constructor(
showErrorView(false)
showProgress(true)
}
- loadData(true)
+ loadData(currentDate, true)
}
fun onDetailsClick() {
@@ -102,8 +102,8 @@ class AttendancePresenter @Inject constructor(
if (view.currentStackSize == 1) {
baseDate.also {
if (currentDate != it) {
- reloadView(it)
- loadData()
+ loadData(it)
+ reloadView()
} else if (!view.isViewEmpty) view.resetView()
}
} else view.popView()
@@ -184,30 +184,17 @@ class AttendancePresenter @Inject constructor(
}.launch("holidays")
}
- private fun loadData(forceRefresh: Boolean = false) {
+ private fun loadData(date: LocalDate, forceRefresh: Boolean = false) {
Timber.i("Loading attendance data started")
+ currentDate = date
flowWithResourceIn {
val student = studentRepository.getCurrentStudent()
val semester = semesterRepository.getCurrentSemester(student)
- attendanceRepository.getAttendance(student, semester, currentDate, currentDate, forceRefresh)
+ attendanceRepository.getAttendance(student, semester, date, date, forceRefresh)
}.onEach {
when (it.status) {
- Status.LOADING -> {
- view?.showExcuseButton(false)
- if (!it.data.isNullOrEmpty()) {
- view?.run {
- enableSwipe(true)
- showRefresh(true)
- showProgress(false)
- showContent(true)
- updateData(it.data.let { items ->
- if (prefRepository.isShowPresent) items
- else items.filter { item -> !item.presence }
- }.sortedBy { item -> item.number })
- }
- }
- }
+ Status.LOADING -> view?.showExcuseButton(false)
Status.SUCCESS -> {
Timber.i("Loading attendance result: Success")
view?.apply {
@@ -233,7 +220,7 @@ class AttendancePresenter @Inject constructor(
}
}.afterLoading {
view?.run {
- showRefresh(false)
+ hideRefresh()
showProgress(false)
enableSwipe(true)
}
@@ -263,12 +250,12 @@ class AttendancePresenter @Inject constructor(
showContent(true)
showProgress(false)
}
- loadData(forceRefresh = true)
+ loadData(currentDate, forceRefresh = true)
}
Status.ERROR -> {
Timber.i("Excusing for absence result: An exception occurred")
errorHandler.dispatch(it.error!!)
- loadData()
+ loadData(currentDate)
}
}
}.launch("excuse")
@@ -285,14 +272,11 @@ class AttendancePresenter @Inject constructor(
}
}
- private fun reloadView(date: LocalDate) {
- currentDate = date
-
+ private fun reloadView() {
Timber.i("Reload attendance view with the date ${currentDate.toFormattedString()}")
view?.apply {
showProgress(true)
enableSwipe(false)
- showRefresh(false)
showContent(false)
showEmpty(false)
showErrorView(false)
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendanceView.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendanceView.kt
index 0459dfcf..d54fb8bf 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendanceView.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendanceView.kt
@@ -24,7 +24,7 @@ interface AttendanceView : BaseView {
fun clearData()
- fun showRefresh(show: Boolean)
+ fun hideRefresh()
fun resetView()
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryFragment.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryFragment.kt
index 118971e6..2f862237 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryFragment.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryFragment.kt
@@ -15,7 +15,6 @@ import io.github.wulkanowy.databinding.FragmentAttendanceSummaryBinding
import io.github.wulkanowy.ui.base.BaseFragment
import io.github.wulkanowy.ui.modules.main.MainView
import io.github.wulkanowy.utils.dpToPx
-import io.github.wulkanowy.utils.getThemeAttrColor
import io.github.wulkanowy.utils.setOnItemSelectedListener
import javax.inject.Inject
@@ -57,8 +56,6 @@ class AttendanceSummaryFragment :
with(binding) {
attendanceSummarySwipe.setOnRefreshListener(presenter::onSwipeRefresh)
- attendanceSummarySwipe.setColorSchemeColors(requireContext().getThemeAttrColor(R.attr.colorPrimary))
- attendanceSummarySwipe.setProgressBackgroundColorSchemeColor(requireContext().getThemeAttrColor(R.attr.colorSwipeRefresh))
attendanceSummaryErrorRetry.setOnClickListener { presenter.onRetry() }
attendanceSummaryErrorDetails.setOnClickListener { presenter.onDetailsClick() }
}
@@ -124,8 +121,8 @@ class AttendanceSummaryFragment :
binding.attendanceSummarySubjectsContainer.visibility = if (show) VISIBLE else INVISIBLE
}
- override fun showRefresh(show: Boolean) {
- binding.attendanceSummarySwipe.isRefreshing = show
+ override fun hideRefresh() {
+ binding.attendanceSummarySwipe.isRefreshing = false
}
override fun onSaveInstanceState(outState: Bundle) {
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryPresenter.kt
index e53cda74..e5dce9ac 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryPresenter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryPresenter.kt
@@ -1,15 +1,14 @@
package io.github.wulkanowy.ui.modules.attendance.summary
import io.github.wulkanowy.data.Status
-import io.github.wulkanowy.data.db.entities.AttendanceSummary
import io.github.wulkanowy.data.db.entities.Subject
-import io.github.wulkanowy.data.repositories.AttendanceSummaryRepository
-import io.github.wulkanowy.data.repositories.SemesterRepository
-import io.github.wulkanowy.data.repositories.StudentRepository
-import io.github.wulkanowy.data.repositories.SubjectRepository
+import io.github.wulkanowy.data.repositories.attendancesummary.AttendanceSummaryRepository
+import io.github.wulkanowy.data.repositories.semester.SemesterRepository
+import io.github.wulkanowy.data.repositories.student.StudentRepository
+import io.github.wulkanowy.data.repositories.subject.SubjectRepository
import io.github.wulkanowy.ui.base.BasePresenter
import io.github.wulkanowy.ui.base.ErrorHandler
-import io.github.wulkanowy.utils.AnalyticsHelper
+import io.github.wulkanowy.utils.FirebaseAnalyticsHelper
import io.github.wulkanowy.utils.afterLoading
import io.github.wulkanowy.utils.flowWithResourceIn
import kotlinx.coroutines.flow.onEach
@@ -23,7 +22,7 @@ class AttendanceSummaryPresenter @Inject constructor(
private val attendanceSummaryRepository: AttendanceSummaryRepository,
private val subjectRepository: SubjectRepository,
private val semesterRepository: SemesterRepository,
- private val analytics: AnalyticsHelper
+ private val analytics: FirebaseAnalyticsHelper
) : BasePresenter(errorHandler, studentRepository) {
private var subjects = emptyList()
@@ -75,8 +74,6 @@ class AttendanceSummaryPresenter @Inject constructor(
}
private fun loadData(subjectId: Int, forceRefresh: Boolean = false) {
- Timber.i("Loading attendance summary data started")
-
currentSubjectId = subjectId
flowWithResourceIn {
@@ -85,23 +82,15 @@ class AttendanceSummaryPresenter @Inject constructor(
attendanceSummaryRepository.getAttendanceSummary(student, semester, subjectId, forceRefresh)
}.onEach {
when (it.status) {
- Status.LOADING -> {
- if (!it.data.isNullOrEmpty()) {
- view?.run {
- enableSwipe(true)
- showRefresh(true)
- showProgress(false)
- showContent(true)
- updateDataSet(sortItems(it.data))
- }
- }
- }
+ Status.LOADING -> Timber.i("Loading attendance summary data started")
Status.SUCCESS -> {
Timber.i("Loading attendance summary result: Success")
view?.apply {
showEmpty(it.data!!.isEmpty())
showContent(it.data.isNotEmpty())
- updateDataSet(sortItems(it.data))
+ updateDataSet(it.data.sortedByDescending { item ->
+ if (item.month.value <= Month.JUNE.value) item.month.value + 12 else item.month.value
+ })
}
analytics.logEvent(
"load_data",
@@ -117,17 +106,13 @@ class AttendanceSummaryPresenter @Inject constructor(
}
}.afterLoading {
view?.run {
- showRefresh(false)
+ hideRefresh()
showProgress(false)
enableSwipe(true)
}
}.launch()
}
- private fun sortItems(items: List) = items.sortedByDescending { item ->
- if (item.month.value <= Month.JUNE.value) item.month.value + 12 else item.month.value
- }
-
private fun showErrorViewOnError(message: String, error: Throwable) {
view?.run {
if (isViewEmpty) {
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryView.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryView.kt
index 66f370c5..dd4053c7 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryView.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryView.kt
@@ -9,7 +9,7 @@ interface AttendanceSummaryView : BaseView {
fun initView()
- fun showRefresh(show: Boolean)
+ fun hideRefresh()
fun showContent(show: Boolean)
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/conference/ConferenceAdapter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/conference/ConferenceAdapter.kt
deleted file mode 100644
index c8728614..00000000
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/conference/ConferenceAdapter.kt
+++ /dev/null
@@ -1,36 +0,0 @@
-package io.github.wulkanowy.ui.modules.conference
-
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import androidx.recyclerview.widget.RecyclerView
-import io.github.wulkanowy.data.db.entities.Conference
-import io.github.wulkanowy.databinding.ItemConferenceBinding
-import io.github.wulkanowy.utils.toFormattedString
-import javax.inject.Inject
-
-class ConferenceAdapter @Inject constructor() :
- RecyclerView.Adapter() {
-
- var items = emptyList()
-
- override fun getItemCount() = items.size
-
- override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ItemViewHolder(
- ItemConferenceBinding.inflate(LayoutInflater.from(parent.context), parent, false)
- )
-
- override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
- val item = items[position]
- with(holder.binding) {
- conferenceItemDate.text = item.date.toFormattedString("dd.MM.yyyy HH:mm")
- conferenceItemName.text = item.presentOnConference
- conferenceItemTitle.text = item.title
- conferenceItemSubject.text = item.subject
- conferenceItemContent.text = item.agenda
- conferenceItemContent.visibility = if (item.agenda.isBlank()) View.GONE else View.VISIBLE
- }
- }
-
- class ItemViewHolder(val binding: ItemConferenceBinding) : RecyclerView.ViewHolder(binding.root)
-}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/conference/ConferenceFragment.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/conference/ConferenceFragment.kt
deleted file mode 100644
index dd10a65e..00000000
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/conference/ConferenceFragment.kt
+++ /dev/null
@@ -1,105 +0,0 @@
-package io.github.wulkanowy.ui.modules.conference
-
-import android.os.Bundle
-import android.view.View
-import androidx.recyclerview.widget.LinearLayoutManager
-import dagger.hilt.android.AndroidEntryPoint
-import io.github.wulkanowy.R
-import io.github.wulkanowy.data.db.entities.Conference
-import io.github.wulkanowy.databinding.FragmentConferenceBinding
-import io.github.wulkanowy.ui.base.BaseFragment
-import io.github.wulkanowy.ui.modules.main.MainView
-import io.github.wulkanowy.ui.widgets.DividerItemDecoration
-import io.github.wulkanowy.utils.getThemeAttrColor
-import javax.inject.Inject
-
-@AndroidEntryPoint
-class ConferenceFragment : BaseFragment(R.layout.fragment_conference),
- ConferenceView, MainView.TitledView {
-
- @Inject
- lateinit var presenter: ConferencePresenter
-
- @Inject
- lateinit var conferencesAdapter: ConferenceAdapter
-
- companion object {
- fun newInstance() = ConferenceFragment()
- }
-
- override val isViewEmpty: Boolean
- get() = conferencesAdapter.items.isEmpty()
-
- override val titleStringId: Int
- get() = R.string.conferences_title
-
- override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
- super.onViewCreated(view, savedInstanceState)
- binding = FragmentConferenceBinding.bind(view)
- messageContainer = binding.conferenceRecycler
- presenter.onAttachView(this)
- }
-
- override fun initView() {
- with(binding.conferenceRecycler) {
- layoutManager = LinearLayoutManager(context)
- adapter = conferencesAdapter
- addItemDecoration(DividerItemDecoration(context))
- }
-
- with(binding) {
- conferenceSwipe.setOnRefreshListener(presenter::onSwipeRefresh)
- conferenceSwipe.setColorSchemeColors(requireContext().getThemeAttrColor(R.attr.colorPrimary))
- conferenceSwipe.setProgressBackgroundColorSchemeColor(requireContext().getThemeAttrColor(R.attr.colorSwipeRefresh))
- conferenceErrorRetry.setOnClickListener { presenter.onRetry() }
- conferenceErrorDetails.setOnClickListener { presenter.onDetailsClick() }
- }
- }
-
- override fun updateData(data: List) {
- with(conferencesAdapter) {
- items = data
- notifyDataSetChanged()
- }
- }
-
- override fun clearData() {
- with(conferencesAdapter) {
- items = emptyList()
- notifyDataSetChanged()
- }
- }
-
- override fun showRefresh(show: Boolean) {
- binding.conferenceSwipe.isRefreshing = show
- }
-
- override fun showProgress(show: Boolean) {
- binding.conferenceProgress.visibility = if (show) View.VISIBLE else View.GONE
- }
-
- override fun showEmpty(show: Boolean) {
- binding.conferenceEmpty.visibility = if (show) View.VISIBLE else View.GONE
- }
-
- override fun showErrorView(show: Boolean) {
- binding.conferenceError.visibility = if (show) View.VISIBLE else View.GONE
- }
-
- override fun setErrorDetails(message: String) {
- binding.conferenceErrorMessage.text = message
- }
-
- override fun enableSwipe(enable: Boolean) {
- binding.conferenceSwipe.isEnabled = enable
- }
-
- override fun showContent(show: Boolean) {
- binding.conferenceRecycler.visibility = if (show) View.VISIBLE else View.GONE
- }
-
- override fun onDestroyView() {
- presenter.onDetachView()
- super.onDestroyView()
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/conference/ConferencePresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/conference/ConferencePresenter.kt
deleted file mode 100644
index cc7e50db..00000000
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/conference/ConferencePresenter.kt
+++ /dev/null
@@ -1,108 +0,0 @@
-package io.github.wulkanowy.ui.modules.conference
-
-import io.github.wulkanowy.data.Status
-import io.github.wulkanowy.data.repositories.ConferenceRepository
-import io.github.wulkanowy.data.repositories.SemesterRepository
-import io.github.wulkanowy.data.repositories.StudentRepository
-import io.github.wulkanowy.ui.base.BasePresenter
-import io.github.wulkanowy.ui.base.ErrorHandler
-import io.github.wulkanowy.utils.AnalyticsHelper
-import io.github.wulkanowy.utils.afterLoading
-import io.github.wulkanowy.utils.flowWithResourceIn
-import kotlinx.coroutines.flow.onEach
-import timber.log.Timber
-import javax.inject.Inject
-
-class ConferencePresenter @Inject constructor(
- errorHandler: ErrorHandler,
- studentRepository: StudentRepository,
- private val semesterRepository: SemesterRepository,
- private val conferenceRepository: ConferenceRepository,
- private val analytics: AnalyticsHelper
-) : BasePresenter