From da16ca616027c5ba374f7b3b9d11ce52d91229bf Mon Sep 17 00:00:00 2001 From: Yuan Chiu Date: Mon, 16 Mar 2015 21:45:52 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20=E6=8E=A8=E8=96=A6=E5=AD=B8=E7=BF=92?= =?UTF-8?q?=E9=BB=9E=E6=99=82=EF=BC=8C=E6=9C=83=E5=88=A4=E6=96=B7=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E9=82=84=E6=9C=89=E5=89=A9=E9=A4=98=E7=9A=84=E5=AD=B8?= =?UTF-8?q?=E7=BF=92=E6=99=82=E9=96=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/api/v2/index.php | 40 +++++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/htdocs/api/v2/index.php b/htdocs/api/v2/index.php index 5edcabf..5d1dd55 100644 --- a/htdocs/api/v2/index.php +++ b/htdocs/api/v2/index.php @@ -1221,22 +1221,33 @@ $app->group('/tokens', 'APIrequest', function () use ($app, $app_template) { // 取得本次採用的教材風格 $materialMode = $sact->getMaterialStyle(); - // 取得推薦的學習點 - $recommand = new Recommand\RecommandPoint(); - $recommandResult = $recommand->recommand($currentTId, $saId); - $recommandTotal = count($recommandResult); - if($recommandTotal > $maxItemTotal) { - $result_recommand_total = $maxItemTotal; - } - else { - $result_recommand_total = $recommandTotal; + // 學習時間已過並設強制結束 + if($sact->isForceLearnTime() && $sact->getRemainingTime() <= 0) { + $isEnd = true; + + $recommandResult = array(); + $recommandTotal = 0; } // 是否已經學完了 - if($sact->getRemainingPointTotal() <= 0) { + else if($sact->getRemainingPointTotal() <= 0) { $isEnd = true; + + $recommandResult = array(); + $recommandTotal = 0; } else { $isEnd = false; + + // 取得推薦的學習點 + $recommand = new Recommand\RecommandPoint(); + $recommandResult = $recommand->recommand($currentTId, $saId); + $recommandTotal = count($recommandResult); + if($recommandTotal > $maxItemTotal) { + $result_recommand_total = $maxItemTotal; + } + else { + $result_recommand_total = $recommandTotal; + } } // 製作 @@ -1353,8 +1364,15 @@ $app->group('/tokens', 'APIrequest', function () use ($app, $app_template) { // 取得本次採用的教材風格 $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; $recommandResult = array();