🐛 Fix poll yes or no stats
This commit is contained in:
		| @@ -44,13 +44,13 @@ class PollStatsWidget extends StatelessWidget { | |||||||
|         // yes/no: map {true: count, false: count} |         // yes/no: map {true: count, false: count} | ||||||
|         if (raw is Map) { |         if (raw is Map) { | ||||||
|           final int yes = |           final int yes = | ||||||
|               (raw[true] is int) |               (raw['true'] is int) | ||||||
|                   ? raw[true] as int |                   ? raw['true'] as int | ||||||
|                   : int.tryParse('${raw[true]}') ?? 0; |                   : int.tryParse('${raw['true']}') ?? 0; | ||||||
|           final int no = |           final int no = | ||||||
|               (raw[false] is int) |               (raw['false'] is int) | ||||||
|                   ? raw[false] as int |                   ? raw['false'] as int | ||||||
|                   : int.tryParse('${raw[false]}') ?? 0; |                   : int.tryParse('${raw['false']}') ?? 0; | ||||||
|           final total = (yes + no).clamp(0, 1 << 31); |           final total = (yes + no).clamp(0, 1 << 31); | ||||||
|           final yesPct = total == 0 ? 0.0 : yes / total; |           final yesPct = total == 0 ? 0.0 : yes / total; | ||||||
|           final noPct = total == 0 ? 0.0 : no / total; |           final noPct = total == 0 ? 0.0 : no / total; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user