dessalines / rank-my-favs

An Android app to rank your favorite things, using simple pair-wise matchups.
GNU Affero General Public License v3.0
39 stars 1 forks source link

Made tier lists configurable #157

Closed iByteABit256 closed 2 weeks ago

iByteABit256 commented 1 month ago

Closes #149

Added edit mode to Tier List

Gives user the ability to:

All these changes are persisted and are unique to the fav list, so you can make a different one for each one of your lists.

Demo

https://github.com/user-attachments/assets/4031ecf6-d32e-4a01-8492-7d992a5f3646

dessalines commented 1 month ago

Sry for being slow, I should be back next week to be able to test this.

dessalines commented 4 weeks ago

I get a migration error with this, most likely due to incorrect column order, or missing keys.

FATAL EXCEPTION: main
Process: com.dessalines.rankmyfavs.debug, PID: 22287
java.lang.IllegalStateException: Migration didn't properly handle: TierList(com.dessalines.rankmyfavs.db.TierList).
 Expected:
TableInfo{name='TierList', columns={name=Column{name='name', type='TEXT', affinity='2', notNull=true, primaryKeyPosition=0, defaultValue='undefined'}, tier_order=Column{name='tier_order', type='INTEGER', affinity='3', notNull=true, primaryKeyPosition=0, defaultValue='undefined'}, id=Column{name='id', type='INTEGER', affinity='3', notNull=true, primaryKeyPosition=1, defaultValue='undefined'}, color=Column{name='color', type='INTEGER', affinity='3', notNull=true, primaryKeyPosition=0, defaultValue='undefined'}, fav_list_id=Column{name='fav_list_id', type='INTEGER', affinity='3', notNull=true, primaryKeyPosition=0, defaultValue='undefined'}}, foreignKeys=[ForeignKey{referenceTable='FavList', onDelete='CASCADE +', onUpdate='NO ACTION', columnNames=[fav_list_id], referenceColumnNames=[id]}], indices=[Index{name='index_TierList_fav_list_id', unique=false, columns=[fav_list_id], orders=[ASC]'}, Index{name='index_TierList_tier_order', unique=false, columns=[tier_order], orders=[ASC]'}]}
 Found:
TableInfo{name='TierList', columns={id=Column{name='id', type='INTEGER', affinity='3', notNull=false, primaryKeyPosition=1, defaultValue='undefined'}, fav_list_id=Column{name='fav_list_id', type='INTEGER', affinity='3', notNull=true, primaryKeyPosition=0, defaultValue='undefined'}, name=Column{name='name', type='TEXT', affinity='2', notNull=true, primaryKeyPosition=0, defaultValue='undefined'}, color=Column{name='color', type='INTEGER', affinity='3', notNull=true, primaryKeyPosition=0, defaultValue='undefined'}, tier_order=Column{name='tier_order', type='INTEGER', affinity='3', notNull=true, primaryKeyPosition=0, defaultValue='undefined'}}, foreignKeys=[], indices=[]}
    at androidx.room.RoomOpenHelper.onUpgrade(RoomOpenHelper.kt:93)
    at androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper$OpenHelper.onUpgrade(FrameworkSQLiteOpenHelper.kt:253)
    at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:416)
    at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:316)
    at androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper$OpenHelper.getWritableOrReadableDatabase(FrameworkSQLiteOpenHelper.kt:232)
    at androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper$OpenHelper.innerGetDatabase(FrameworkSQLiteOpenHelper.kt:190)
    at androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper$OpenHelper.getSupportDatabase(FrameworkSQLiteOpenHelper.kt:151)
    at androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper.getWritableDatabase(FrameworkSQLiteOpenHelper.kt:104)
    at androidx.room.RoomDatabase.inTransaction(RoomDatabase.kt:632)
    at androidx.room.RoomDatabase.assertNotSuspendingTransaction(RoomDatabase.kt:451)
    at androidx.room.RoomDatabase.query(RoomDatabase.kt:480)
    at androidx.room.util.DBUtil.query(DBUtil.kt:75)
    at com.dessalines.rankmyfavs.db.AppSettingsDao_Impl$5.call(AppSettingsDao_Impl.java:118)
    at com.dessalines.rankmyfavs.db.AppSettingsDao_Impl$5.call(AppSettingsDao_Impl.java:114)
    at androidx.room.CoroutinesRoom$Companion$createFlow$1$1$1.invokeSuspend(CoroutinesRoom.kt:129)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
    at java.lang.Thread.run(Thread.java:1012)
    Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@4d9f1c3, Dispatchers.Main.immediate]
iByteABit256 commented 3 weeks ago

Added the foreign key and some indexes, couldn't reproduce the migration error, but maybe it will be fixed with the new changes.

iByteABit256 commented 2 weeks ago

I was able to reproduce it and fix it now, sorry for the back and forth!