diff --git a/COMPLETED.md b/COMPLETED.md index c725225..7b7c080 100644 --- a/COMPLETED.md +++ b/COMPLETED.md @@ -1,3 +1,11 @@ +# NOTE + +Current highest implemented generation: **Three** +**This file is automatically generated** + +# About + +This file is a checklist of what Pokemon are up to date with the implemented generations. # Generation One diff --git a/lib/updateTool.dart b/lib/updateTool.dart index f348827..8e52964 100644 --- a/lib/updateTool.dart +++ b/lib/updateTool.dart @@ -95,6 +95,16 @@ class _main extends State { setState(() {}); } else if (state == 4) { maxTasks += Pokemon.values.length; + sb = StringBuilder(); + sb.append("# NOTE\n"); + sb.append( + "\nCurrent highest implemented generation: **${gen.name}**", + ); + sb.append("\n**This file is automatically generated**\n\n"); + sb.append("# About\n\n"); + sb.append( + "This file is a checklist of what Pokemon are up to date with the implemented generations.\n", + ); state++; setState(() {}); } else if ((state - index) == 5) { @@ -118,20 +128,40 @@ class _main extends State { statusMessage = ("- Analysis of pokemon ${pokemon.pokemonName} has begun"); - // TODO : This needs to check locations and dex entries to see if they are up to date with the latest generation. - // The future task should take into account the generation the pokemon was introduced in. (EX. If introduced in gen 2, it won't have data entries for gen 1). + bool upToDate = false; + + for (var loc in pokemon.locations) { + if (loc.gameGen.index >= gen.index) { + upToDate = true; + } + } + + bool dexUpToDate = false; + + for (var dex in pokemon.dexEntries) { + if (dex.gameGen.index >= gen.index) { + upToDate = true; + } + } if (pokemon.locations.isEmpty && pokemon.dexEntries.isEmpty) { sb.append("- [ ] ${pokemon.pokemonName}\n"); } else { - if (pokemon.locations.isNotEmpty && pokemon.dexEntries.isNotEmpty) { - sb.append("- [x] ${pokemon.pokemonName}\n"); - } else if (pokemon.locations.isNotEmpty) { - sb.append("- [ ] ${pokemon.pokemonName} (MISSING DEX ENTRIES)\n"); - } else if (pokemon.dexEntries.isNotEmpty) { - sb.append( - "- [ ] ${pokemon.pokemonName} (MISSING LOCATION ENTRIES)\n", - ); + if (upToDate || dexUpToDate) { + if (pokemon.locations.isNotEmpty && + pokemon.dexEntries.isNotEmpty) { + sb.append("- [x] ${pokemon.pokemonName}\n"); + } else if (pokemon.locations.isNotEmpty) { + sb.append( + "- [ ] ${pokemon.pokemonName} (MISSING DEX ENTRIES)\n", + ); + } else if (pokemon.dexEntries.isNotEmpty) { + sb.append( + "- [ ] ${pokemon.pokemonName} (MISSING LOCATION ENTRIES)\n", + ); + } + } else { + sb.append("- [ ] ${pokemon.pokemonName} (OUT OF DATE DATA)\n"); } } index++; @@ -170,14 +200,20 @@ class _main extends State { title: Text("Data Generator"), backgroundColor: LibACFlutterConstants.TITLEBAR_COLOR, ), - body: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text("Status: ${statusMessage}", style: TextStyle(fontSize: 24)), - Text("Progress: ${progress * 100}%", style: TextStyle(fontSize: 24)), - Text("Task ${state}/${maxTasks}", style: TextStyle(fontSize: 24)), - LinearProgressIndicator(value: progress, minHeight: 30), - ], + body: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text("Status: ${statusMessage}", style: TextStyle(fontSize: 24)), + Text( + "Progress: ${progress * 100}%", + style: TextStyle(fontSize: 24), + ), + Text("Task ${state}/${maxTasks}", style: TextStyle(fontSize: 24)), + LinearProgressIndicator(value: progress, minHeight: 30), + ], + ), ), ); }