diff --git a/htdocs/api/v2/index.php b/htdocs/api/v2/index.php index 2b82909..0cbfbc3 100644 --- a/htdocs/api/v2/index.php +++ b/htdocs/api/v2/index.php @@ -1208,9 +1208,12 @@ $app->group('/tokens', 'APIrequest', function () use ($app, $app_template) { $result_recommand_total = $recommandTotal; } // 是否已經學完了 - // TODO: 改以取得已學習標的數來判定 - if($recommandTotal <= 0) { $isEnd = true; } - else { $isEnd = false; } + if($sact->getRemainingPointTotal() <= 0) { + $isEnd = true; + } + else { + $isEnd = false; + } // 製作 $output_targets = array(); diff --git a/htdocs/lib/Recommand/RecommandPoint.php b/htdocs/lib/Recommand/RecommandPoint.php index fd9eef1..24499fe 100644 --- a/htdocs/lib/Recommand/RecommandPoint.php +++ b/htdocs/lib/Recommand/RecommandPoint.php @@ -163,11 +163,14 @@ class RecommandPoint "VirtualCost"=>$virtualCost)); } - foreach($recommand as $key=>$value) - { - $tmp[$key] = $value["PathCost"]; + if(count($recommand) >= 1) { + + foreach($recommand as $key=>$value) + { + $tmp[$key] = $value["PathCost"]; + } + array_multisort($tmp,SORT_DESC,$recommand,SORT_DESC); } - array_multisort($tmp,SORT_DESC,$recommand,SORT_DESC); return $recommand; } diff --git a/htdocs/lib/Study/StudyActivity.php b/htdocs/lib/Study/StudyActivity.php index de99a18..8e72767 100644 --- a/htdocs/lib/Study/StudyActivity.php +++ b/htdocs/lib/Study/StudyActivity.php @@ -171,7 +171,7 @@ class StudyActivity { $total = $this->getPointTotal(); $learned = $this->getLearnedPointTotal(); - return $total - $learned; + return ($total-1) - $learned; } // ========================================================================