@@ -47,13 +47,13 @@ QJsonObject ExportUtil::buildExportJson(Contest *contest) {
4747 int totalScore = i->getTotalScore ();
4848
4949 if (totalScore != -1 ) {
50- sortList.append (std::make_pair (totalScore, i->getContestantName ()));
50+ sortList.append (std::make_pair (- totalScore, i->getContestantName ()));
5151 } else {
52- sortList.append (std::make_pair (- 1 , i->getContestantName ()));
52+ sortList.append (std::make_pair (1 , i->getContestantName ()));
5353 }
5454 }
5555
56- std::sort (sortList.begin (), sortList.end (), std::greater<>() );
56+ std::sort (sortList.begin (), sortList.end ());
5757 QMap<QString, int > rankList;
5858
5959 for (int i = 0 ; i < sortList.size (); i++) {
@@ -95,8 +95,8 @@ QJsonObject ExportUtil::buildExportJson(Contest *contest) {
9595
9696 QJsonArray contestantsArr;
9797
98- for (int idx = 0 ; idx < contestantList .size (); idx++) {
99- Contestant *contestant = contestantList [idx];
98+ for (int idx = 0 ; idx < sortList .size (); idx++) {
99+ Contestant *contestant = contest-> getContestant (sortList [idx]. second ) ;
100100 QJsonObject cObj;
101101 cObj[" name" ] = contestant->getContestantName ();
102102 cObj[" rank" ] = rankList[contestant->getContestantName ()] + 1 ;
@@ -349,13 +349,13 @@ void ExportUtil::exportCsv(QWidget *widget, Contest *contest, const QString &fil
349349 int totalScore = i->getTotalScore ();
350350
351351 if (totalScore != -1 ) {
352- sortList.append (std::make_pair (totalScore, i->getContestantName ()));
352+ sortList.append (std::make_pair (- totalScore, i->getContestantName ()));
353353 } else {
354- sortList.append (std::make_pair (- 1 , i->getContestantName ()));
354+ sortList.append (std::make_pair (1 , i->getContestantName ()));
355355 }
356356 }
357357
358- std::sort (sortList.begin (), sortList.end (), std::greater<>() );
358+ std::sort (sortList.begin (), sortList.end ());
359359 QMap<QString, int > rankList;
360360
361361 for (int i = 0 ; i < sortList.size (); i++) {
0 commit comments