calcCompleted method
Implementation
String calcCompleted(String contestId, bool isPast) {
int count = 0;
List<ContestDataModel> data = !isPast ? _contestData : _pastContestData;
_userData
.where((element) => element.contestId == contestId)
.forEach((element) {
bool flag = false;
for (var element in element.milestonesData!) {
if (element.isCompleted == true) {
flag = true;
} else {
flag = false;
}
}
if (flag == true) {
count++;
}
});
return "$count/${data.where((element) => element.sId == contestId).first.challenges!.length}";
}