I think you should keep number of tasks directly in 'Games' table:
yield (g.id, g.name, g.version, g.location, g.startTime, g.endTime, g.status, g.image, g.taskNo)