Fix getRemainingPointTotal 不包含入口本身 & Fix API Recommand is_end

This commit is contained in:
Yuan Chiu 2015-01-29 00:23:48 +08:00
parent 009d8eea2c
commit 86b3e562a6
3 changed files with 14 additions and 8 deletions

View File

@ -1208,9 +1208,12 @@ $app->group('/tokens', 'APIrequest', function () use ($app, $app_template) {
$result_recommand_total = $recommandTotal; $result_recommand_total = $recommandTotal;
} }
// 是否已經學完了 // 是否已經學完了
// TODO: 改以取得已學習標的數來判定 if($sact->getRemainingPointTotal() <= 0) {
if($recommandTotal <= 0) { $isEnd = true; } $isEnd = true;
else { $isEnd = false; } }
else {
$isEnd = false;
}
// 製作 // 製作
$output_targets = array(); $output_targets = array();

View File

@ -163,11 +163,14 @@ class RecommandPoint
"VirtualCost"=>$virtualCost)); "VirtualCost"=>$virtualCost));
} }
foreach($recommand as $key=>$value) if(count($recommand) >= 1) {
{
$tmp[$key] = $value["PathCost"]; 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; return $recommand;
} }

View File

@ -171,7 +171,7 @@ class StudyActivity {
$total = $this->getPointTotal(); $total = $this->getPointTotal();
$learned = $this->getLearnedPointTotal(); $learned = $this->getLearnedPointTotal();
return $total - $learned; return ($total-1) - $learned;
} }
// ======================================================================== // ========================================================================