diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Librus.java b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Librus.java index cba9b250..32468093 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Librus.java +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Librus.java @@ -2821,7 +2821,7 @@ public class Librus implements EdziennikInterface { ); eventList.add(eventObject); - metadataList.add(new Metadata(profileId, Metadata.TYPE_EVENT, eventObject.id, profile.getEmpty(), profile.getEmpty(), addedDate.getInMillis())); + metadataList.add(new Metadata(profileId, Metadata.TYPE_HOMEWORK, eventObject.id, profile.getEmpty(), profile.getEmpty(), addedDate.getInMillis())); } r("finish", "Homework"); } diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/db/AppDb.java b/app/src/main/java/pl/szczodrzynski/edziennik/data/db/AppDb.java index 9f23d38b..b06a2135 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/db/AppDb.java +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/db/AppDb.java @@ -87,7 +87,7 @@ import android.content.Context; DebugLog.class, EndpointTimer.class, LessonRange.class, - Metadata.class}, version = 57) + Metadata.class}, version = 58) @TypeConverters({ ConverterTime.class, ConverterDate.class, @@ -597,6 +597,12 @@ public abstract class AppDb extends RoomDatabase { database.execSQL("ALTER TABLE gradeCategories ADD type INTEGER NOT NULL DEFAULT 0"); } }; + private static final Migration MIGRATION_57_58 = new Migration(57, 58) { + @Override + public void migrate(@NonNull SupportSQLiteDatabase database) { + database.execSQL("UPDATE metadata SET thingType = 5 WHERE thingType = 4 AND thingId IN (SELECT eventId FROM events WHERE eventType = -1)"); + } + }; public static AppDb getDatabase(final Context context) { @@ -651,7 +657,8 @@ public abstract class AppDb extends RoomDatabase { MIGRATION_53_54, MIGRATION_54_55, MIGRATION_55_56, - MIGRATION_56_57 + MIGRATION_56_57, + MIGRATION_57_58 ) .allowMainThreadQueries() //.fallbackToDestructiveMigration()