db update
Browse files- src/lib/db/piclets.ts +28 -1
src/lib/db/piclets.ts
CHANGED
|
@@ -103,7 +103,34 @@ export async function getPicletInstance(id: number): Promise<PicletInstance | un
|
|
| 103 |
|
| 104 |
// Get collected piclets (those that have been discovered)
|
| 105 |
export async function getCollectedPiclets(): Promise<PicletInstance[]> {
|
| 106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
}
|
| 108 |
|
| 109 |
// Get canonical piclets
|
|
|
|
| 103 |
|
| 104 |
// Get collected piclets (those that have been discovered)
|
| 105 |
export async function getCollectedPiclets(): Promise<PicletInstance[]> {
|
| 106 |
+
console.log('π DEBUG: Getting collected piclets...');
|
| 107 |
+
|
| 108 |
+
// First, let's see ALL records in the database
|
| 109 |
+
const allRecords = await db.picletInstances.toArray();
|
| 110 |
+
console.log('π Total records in DB:', allRecords.length);
|
| 111 |
+
console.log('π All records:', allRecords);
|
| 112 |
+
|
| 113 |
+
// Check what values we have for isInCollection
|
| 114 |
+
allRecords.forEach((record, i) => {
|
| 115 |
+
console.log(`Record ${i}:`, {
|
| 116 |
+
id: record.id,
|
| 117 |
+
typeId: record.typeId,
|
| 118 |
+
nickname: record.nickname,
|
| 119 |
+
isInCollection: record.isInCollection,
|
| 120 |
+
isInCollection_type: typeof record.isInCollection,
|
| 121 |
+
isInCollection_value: JSON.stringify(record.isInCollection)
|
| 122 |
+
});
|
| 123 |
+
});
|
| 124 |
+
|
| 125 |
+
// Now try the query
|
| 126 |
+
try {
|
| 127 |
+
const result = await db.picletInstances.where('isInCollection').equals(true).toArray();
|
| 128 |
+
console.log('β
Query result:', result.length, 'piclets found');
|
| 129 |
+
return result;
|
| 130 |
+
} catch (error) {
|
| 131 |
+
console.error('β Query failed:', error);
|
| 132 |
+
throw error;
|
| 133 |
+
}
|
| 134 |
}
|
| 135 |
|
| 136 |
// Get canonical piclets
|