Alter updatetool to include the completed and total task count in output file

This commit is contained in:
zontreck 2025-06-01 01:48:12 -07:00
parent 8e823e7b9c
commit 310098b39d

View file

@ -49,6 +49,9 @@ class _main extends State<MainGen> {
Generation? currentGen;
int maxTasks = 5;
int total = 0;
int completed = 0;
int state = 0;
@override
@ -125,8 +128,12 @@ class _main extends State<MainGen> {
var pokemon = Pokemon.values[iterNumber];
if (currentGen != pokemon.generation) {
sb.append("\n- Completed ${completed}/${total}\n");
sb.append("\n# Generation ${pokemon.generation.name}\n\n");
currentGen = pokemon.generation;
total = 0;
completed = 0;
}
progress = index * 100 / Pokemon.values.length;
@ -156,6 +163,7 @@ class _main extends State<MainGen> {
if (pokemon.locations.isNotEmpty &&
pokemon.dexEntries.isNotEmpty) {
sb.append("- [x] ${pokemon.pokemonName}\n");
completed++;
} else if (pokemon.locations.isNotEmpty) {
sb.append(
"- [ ] ${pokemon.pokemonName} (MISSING DEX ENTRIES)\n",
@ -169,6 +177,7 @@ class _main extends State<MainGen> {
sb.append("- [ ] ${pokemon.pokemonName} (OUT OF DATE DATA)\n");
}
}
total++;
index++;
progress = progress / 100; // push it into a 0-1 range.
state++;
@ -176,6 +185,8 @@ class _main extends State<MainGen> {
setState(() {});
} else if (state - index == 6) {
// Task - write file
sb.append("\n- Completed ${completed}/${total}\n");
maxTasks += 3;
statusMessage = "Saving to COMPLETED.md";
File complete = File("COMPLETED.md");