1
0
Fork 0
mirror of https://github.com/Nioux/AideDeJeu.git synced 2025-10-29 22:45:44 +00:00

Renommage colonnes

This commit is contained in:
Yan Maniez 2020-02-21 21:28:14 +01:00
parent d4d9f8017b
commit 0d81ea6799
3 changed files with 12 additions and 12 deletions

Binary file not shown.

View file

@ -49,18 +49,18 @@ Future<Item> getItemWithId(String id) async {
} }
Future<Item> loadChildrenItems(Item item) async { Future<Item> loadChildrenItems(Item item) async {
print("getChildrenItems " + item.Discriminator); print("getChildrenItems " + item.ItemType);
if (item.Discriminator.endsWith("Items")) { if (item.ItemType.endsWith("Items")) {
String discriminator = String itemType =
item.Discriminator.substring(0, item.Discriminator.length - 1); item.ItemType.substring(0, item.ItemType.length - 1);
String family = ""; String family = "";
if (item is MonsterItems) { if (item is MonsterItems) {
family = (item as MonsterItems)?.Family ?? ""; family = (item as MonsterItems)?.Family ?? "";
} }
final db = await database; final db = await database;
var response = await db var response = await db
.query("Items", where: "Discriminator = ? AND MonsterItem_Family = ?", .query("Items", where: "ItemType = ? AND Family = ?",
whereArgs: [discriminator, family], whereArgs: [itemType, family],
orderBy: "NormalizedName"); orderBy: "NormalizedName");
if (response.isEmpty) { if (response.isEmpty) {
print("Id not found"); print("Id not found");

View file

@ -12,10 +12,10 @@ class Item {
String Source; String Source;
String Markdown; String Markdown;
String FullText; String FullText;
String Discriminator; String ItemType;
List<Item> Children; List<Item> 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<String, dynamic> map) { Item.fromMap(Map<String, dynamic> map) {
this.Id = map["Id"]; this.Id = map["Id"];
@ -23,7 +23,7 @@ class Item {
this.Alias = map["AltName"]; this.Alias = map["AltName"];
this.AliasText = map["AltNameText"]; this.AliasText = map["AltNameText"];
this.Markdown = map["Markdown"]; this.Markdown = map["Markdown"];
this.Discriminator = map["Discriminator"]; this.ItemType = map["ItemType"];
} }
/*factory Item.fromMap(Map<String, dynamic> json) => new Item( /*factory Item.fromMap(Map<String, dynamic> json) => new Item(
@ -41,7 +41,7 @@ class Item {
"AltName": Alias, "AltName": Alias,
"AltNameText": AliasText, "AltNameText": AliasText,
"Markdown": Markdown, "Markdown": Markdown,
"Discriminator": Discriminator, "ItemType": ItemType,
}; };
} }
@ -132,7 +132,7 @@ class MonsterItems extends Item {
MonsterItems.fromMap(Map<String, dynamic> map) MonsterItems.fromMap(Map<String, dynamic> map)
: super.fromMap(map) { : super.fromMap(map) {
this.Family = map["MonsterItems_Family"]; this.Family = map["Family"];
this.Type = map["Type"]; this.Type = map["Type"];
this.Size = map["Size"]; this.Size = map["Size"];
this.Alignment = map["Alignment"]; this.Alignment = map["Alignment"];
@ -162,7 +162,7 @@ class MonsterItems extends Item {
} }
Item itemFromMap(Map<String, dynamic> map) { Item itemFromMap(Map<String, dynamic> map) {
switch(map["Discriminator"]) { switch(map["ItemType"]) {
case "MonsterItem": return MonsterItem.fromMap(map); case "MonsterItem": return MonsterItem.fromMap(map);
case "MonsterItems": return MonsterItems.fromMap(map); case "MonsterItems": return MonsterItems.fromMap(map);
} }