Fix 推薦學習點時,會判斷是否還有剩餘的學習時間

This commit is contained in:
Yuan Chiu 2015-03-16 21:45:52 +08:00
parent 85095457cc
commit da16ca6160

View File

@ -1221,6 +1221,23 @@ $app->group('/tokens', 'APIrequest', function () use ($app, $app_template) {
// 取得本次採用的教材風格 // 取得本次採用的教材風格
$materialMode = $sact->getMaterialStyle(); $materialMode = $sact->getMaterialStyle();
// 學習時間已過並設強制結束
if($sact->isForceLearnTime() && $sact->getRemainingTime() <= 0) {
$isEnd = true;
$recommandResult = array();
$recommandTotal = 0;
}
// 是否已經學完了
else if($sact->getRemainingPointTotal() <= 0) {
$isEnd = true;
$recommandResult = array();
$recommandTotal = 0;
}
else {
$isEnd = false;
// 取得推薦的學習點 // 取得推薦的學習點
$recommand = new Recommand\RecommandPoint(); $recommand = new Recommand\RecommandPoint();
$recommandResult = $recommand->recommand($currentTId, $saId); $recommandResult = $recommand->recommand($currentTId, $saId);
@ -1231,12 +1248,6 @@ $app->group('/tokens', 'APIrequest', function () use ($app, $app_template) {
else { else {
$result_recommand_total = $recommandTotal; $result_recommand_total = $recommandTotal;
} }
// 是否已經學完了
if($sact->getRemainingPointTotal() <= 0) {
$isEnd = true;
}
else {
$isEnd = false;
} }
// 製作 // 製作
@ -1353,8 +1364,15 @@ $app->group('/tokens', 'APIrequest', function () use ($app, $app_template) {
// 取得本次採用的教材風格 // 取得本次採用的教材風格
$materialMode = $sact->getMaterialStyle(); $materialMode = $sact->getMaterialStyle();
// 學習時間已過並設強制結束
if($sact->isForceLearnTime() && $sact->getRemainingTime() <= 0) {
$isEnd = true;
$recommandResult = array();
$recommandTotal = 0;
}
// 是否已經學完了 // 是否已經學完了
if($sact->getRemainingPointTotal() <= 0) { else if($sact->getRemainingPointTotal() <= 0) {
$isEnd = true; $isEnd = true;
$recommandResult = array(); $recommandResult = array();