Skip to content

Commit c859ea8

Browse files
committed
wip
1 parent 3158ccb commit c859ea8

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

app/src/main/java/com/waldo121/pongstats/MainActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ class MainActivity : ComponentActivity() {
137137
appDatabase = MatchRecordsDatabase.getDatabase(this)
138138

139139
lifecycleScope.launch {
140-
val path = exportRoomDatabase(this@MainActivity, MyRoomDatabase.getInstance(this@MainActivity))
140+
val path = exportRoomDatabase(this@MainActivity, appDatabase)
141141
Toast.makeText(this@MainActivity, "Export terminé : $path", Toast.LENGTH_LONG).show()
142142
}
143143

app/src/main/java/com/waldo121/util/ExportDatabase.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,12 @@ import kotlinx.coroutines.withContext
99
import java.io.File
1010

1111
// Fonction d'export complète
12-
suspend fun exportRoomDatabase(context: Context, db: MyRoomDatabase) = withContext(Dispatchers.IO) {
12+
suspend fun exportRoomDatabase(context: Context, db: MatchRecordsDatabase) = withContext(Dispatchers.IO) {
1313
val gson = GsonBuilder().setPrettyPrinting().create()
1414

1515
// 🔹 Récupère les données de chaque DAO
16-
val users = db.userDao().getAll()
17-
val orders = db.orderDao().getAll()
18-
val products = db.productDao().getAll()
16+
val singleMatches = db.singleMatchRecordDao().getAll()
17+
val doubleMatches = db.DoubleMatchRecordDao().getAll()
1918

2019
// 🔹 Mets tout dans un seul objet
2120
val exportData = mapOf(

0 commit comments

Comments
 (0)