Merge branch 'master' into development_haroon

merge-requests/2/head^2
haroon amjad 2 years ago
commit a142a5e8df

@ -34,6 +34,20 @@ class MarathonApiClient {
); );
} }
Future<int> getMarathonersCount({required String marathonId}) async {
Response response = await ApiClient().getJsonForResponse(
ApiConsts.marathonGetMarathonersCount + '?marathonId=$marathonId',
token: AppState().getMarathonToken == null || AppState().getMarathonToken == "" ? await getMarathonToken() : AppState().getMarathonToken,
);
var json = jsonDecode(response.body);
logger.i("json in getMarathonersCount: $json");
MarathonGenericModel marathonGenericModel = MarathonGenericModel.fromJson(json);
return marathonGenericModel.data as int;
}
Future<String> getProjectId() async { Future<String> getProjectId() async {
return await ApiClient().postJsonForObject( return await ApiClient().postJsonForObject(
(json) { (json) {
@ -89,6 +103,7 @@ class MarathonApiClient {
); );
} }
Future<QuestionModel> getNextQuestion({required String? questionId, required String marathonId}) async { Future<QuestionModel> getNextQuestion({required String? questionId, required String marathonId}) async {
Map<String, String?> jsonObject = <String, String?>{ Map<String, String?> jsonObject = <String, String?>{
"previousQuestionId": questionId, "previousQuestionId": questionId,

@ -37,6 +37,7 @@ class ApiConsts {
static String marathonSubmitAnswerUrl = marathonBaseUrl + "question/submit"; static String marathonSubmitAnswerUrl = marathonBaseUrl + "question/submit";
static String marathonQualifiersUrl = marathonBaseUrl + "winner/getWinner/"; static String marathonQualifiersUrl = marathonBaseUrl + "winner/getWinner/";
static String marathonSelectedWinner = marathonBaseUrl + "winner/getSelectedWinner/"; static String marathonSelectedWinner = marathonBaseUrl + "winner/getSelectedWinner/";
static String marathonGetMarathonersCount = marathonBaseUrl + "Participant/GetRemainingParticipants";
//DummyCards for the UI //DummyCards for the UI
static CardContent dummyQuestion = const CardContent(); static CardContent dummyQuestion = const CardContent();

@ -195,6 +195,7 @@ class MarathonProvider extends ChangeNotifier {
if (isUserWaiting) { if (isUserWaiting) {
MarathonApiClient().joinMarathonAsParticipant().whenComplete(() async { MarathonApiClient().joinMarathonAsParticipant().whenComplete(() async {
await callNextQuestionApi(); await callNextQuestionApi();
totalMarathoners = await MarathonApiClient().getMarathonersCount(marathonId: marathonDetailModel.id!);
}); });
} else { } else {
isButtonEnabled = false; isButtonEnabled = false;

Loading…
Cancel
Save