diff --git a/aidedejeu_flutter/assets/library.db b/aidedejeu_flutter/assets/library.db index 97d74449..c124a8fa 100644 Binary files a/aidedejeu_flutter/assets/library.db and b/aidedejeu_flutter/assets/library.db differ diff --git a/aidedejeu_flutter/lib/database.dart b/aidedejeu_flutter/lib/database.dart index 46f761b0..55be11b0 100644 --- a/aidedejeu_flutter/lib/database.dart +++ b/aidedejeu_flutter/lib/database.dart @@ -49,18 +49,18 @@ Future getItemWithId(String id) async { } Future loadChildrenItems(Item item) async { - print("getChildrenItems " + item.Discriminator); - if (item.Discriminator.endsWith("Items")) { - String discriminator = - item.Discriminator.substring(0, item.Discriminator.length - 1); + print("getChildrenItems " + item.ItemType); + if (item.ItemType.endsWith("Items")) { + String itemType = + item.ItemType.substring(0, item.ItemType.length - 1); String family = ""; if (item is MonsterItems) { family = (item as MonsterItems)?.Family ?? ""; } final db = await database; var response = await db - .query("Items", where: "Discriminator = ? AND MonsterItem_Family = ?", - whereArgs: [discriminator, family], + .query("Items", where: "ItemType = ? AND Family = ?", + whereArgs: [itemType, family], orderBy: "NormalizedName"); if (response.isEmpty) { print("Id not found"); diff --git a/aidedejeu_flutter/lib/models/items.dart b/aidedejeu_flutter/lib/models/items.dart index 3ac88689..1e8a21ba 100644 --- a/aidedejeu_flutter/lib/models/items.dart +++ b/aidedejeu_flutter/lib/models/items.dart @@ -12,10 +12,10 @@ class Item { String Source; String Markdown; String FullText; - String Discriminator; + String ItemType; List Children; - Item({this.Id, this.Name, this.Alias, this.Markdown, this.Discriminator}); + Item({this.Id, this.Name, this.Alias, this.Markdown, this.ItemType}); Item.fromMap(Map map) { this.Id = map["Id"]; @@ -23,7 +23,7 @@ class Item { this.Alias = map["AltName"]; this.AliasText = map["AltNameText"]; this.Markdown = map["Markdown"]; - this.Discriminator = map["Discriminator"]; + this.ItemType = map["ItemType"]; } /*factory Item.fromMap(Map json) => new Item( @@ -41,7 +41,7 @@ class Item { "AltName": Alias, "AltNameText": AliasText, "Markdown": Markdown, - "Discriminator": Discriminator, + "ItemType": ItemType, }; } @@ -132,7 +132,7 @@ class MonsterItems extends Item { MonsterItems.fromMap(Map map) : super.fromMap(map) { - this.Family = map["MonsterItems_Family"]; + this.Family = map["Family"]; this.Type = map["Type"]; this.Size = map["Size"]; this.Alignment = map["Alignment"]; @@ -162,7 +162,7 @@ class MonsterItems extends Item { } Item itemFromMap(Map map) { - switch(map["Discriminator"]) { + switch(map["ItemType"]) { case "MonsterItem": return MonsterItem.fromMap(map); case "MonsterItems": return MonsterItems.fromMap(map); }