Conflicts:
	htdocs/api/v2/index.php
This commit is contained in:
yang 2015-02-05 15:42:38 +08:00
commit 24238a3b3b
7 changed files with 30 additions and 14 deletions

View File

@ -1193,8 +1193,13 @@ $app->group('/tokens', 'APIrequest', function () use ($app, $app_template) {
$currentTId = (int)$currentTId;
<<<<<<< HEAD
$tid = $sact->getThemeId(); // 取得此活動的主題
$maxItemTotal = $sact->getLearnStyle(); // 取得最大推薦數
=======
// 取得此活動的主題
$tid = $sact->getThemeId();
>>>>>>> 345e83e160f83e726d8571e101f54f40a63b7a13
// 取得本次採用的教材風格
$materialMode = $sact->getMaterialStyle();
@ -1210,9 +1215,18 @@ $app->group('/tokens', 'APIrequest', function () use ($app, $app_template) {
$result_recommand_total = $recommandTotal;
}
// 是否已經學完了
<<<<<<< HEAD
// TODO: 改以取得已學習標的數來判定
if($recommandTotal <= 0) { $isEnd = true; }
else { $isEnd = false; }
=======
if($sact->getRemainingPointTotal() <= 0) {
$isEnd = true;
}
else {
$isEnd = false;
}
>>>>>>> 345e83e160f83e726d8571e101f54f40a63b7a13
// 製作
$output_targets = array();

View File

@ -157,7 +157,7 @@ class DBStudyActivity extends Database {
protected function queryActivityByWhere($where) {
$sqlString = "SELECT `SaID`, `UID`, `ThID`, ".
"(SELECT `ThName` FROM `chu__Theme` AS `th` ".
"(SELECT `ThName` FROM `".$this->table('Theme')."` AS `th` ".
"WHERE `th`.`ThID` = `sa`.`ThID`) AS `ThName`, ".
"`StartTime`, ".
"FROM_UNIXTIME(UNIX_TIMESTAMP(`StartTime`)+(`LearnTime`+`Delay`)*60)".
@ -172,8 +172,7 @@ class DBStudyActivity extends Database {
"(SELECT count(DISTINCT `TID`)
FROM `".$this->table('Study')."` AS `study`
WHERE `Out_TargetTime` IS NOT NULL
AND `study`.`SaID` = `sa`.`SaID`) AS `LearnedTotal`".
WHERE `study`.`SaID` = `sa`.`SaID`) AS `LearnedTotal`".
"FROM `".$this->table('StudyActivity')."` AS sa ".
"WHERE ".$where;
@ -754,7 +753,7 @@ SELECT 'study' AS `Type`,
`LMode`, `LModeForce`, `MMode`, `EnableVirtual`, '1' AS `Lock`,
(SELECT count(`TID`) FROM `".$this->table('TBelong')."` AS `belong` WHERE `belong`.`ThID` = `sa`.`ThID`) AS ` TargetTotal`,
(SELECT count(DISTINCT `TID`) FROM `".$this->table('Study')."` AS `study` WHERE `Out_TargetTime` IS NOT NULL AND `study`.`SaID` = `sa`.`SaID`) AS `LearnedTotal`
(SELECT count(DISTINCT `TID`) FROM `".$this->table('Study')."` AS `study` WHERE `study`.`SaID` = `sa`.`SaID`) AS `LearnedTotal`
FROM `".$this->table('StudyActivity')."` AS `sa`
LEFT JOIN `".$this->table('Theme')."` AS `th`

View File

@ -30,7 +30,7 @@ class DBTheme extends Database {
$sqlString = "SELECT `ThID`, `ThName`, ".
"`ThLearnTime`, `StartTID`, `ThIntroduction`, ".
"`ThBuildTime`, `ThModifyTime`, ".
"(SELECT count(`TID`) FROM `chu__TBelong` AS `belong`
"(SELECT count(`TID`) FROM `".$this->table('TBelong')."` AS `belong`
WHERE `belong`.`ThID` = `theme`.`ThID`) AS `TargetTotal`".
"FROM `".$this->table('Theme')."` AS `theme` ".
"WHERE ".$where;

View File

@ -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;
}

View File

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

View File

@ -26,8 +26,8 @@ class StudyManager {
/**
* 取得目前已進入的學習點
* @param string $activity_id 活動編號
* @return string 標的編號若無則null
* @param int $activity_id 活動編號
* @return int 標的編號若無則null
*/
public function getCurrentInTargetId($activity_id) {

View File

@ -267,7 +267,7 @@ class Target {
* @param int $number 學習標的目前人數
* @since 2.0.0
*/
function setMj($number){
public function setMj($number){
$this->setUpdate('Mj', $number);
}
@ -280,7 +280,7 @@ class Target {
* @return int 學習標的目前人數
* @since 2.0.0
*/
function addMj($number){
public function addMj($number){
$setedNum = $this->queryResultArray['Mj']+$number;
if($setedNum < 0) $setedNum = 0;
$this->setUpdate('Mj', $setedNum);