Merge branch 'develop' of https://github.com/CHU-TDAP/E-learning-Server-v2 into develop
Conflicts: htdocs/api/v2/index.php
This commit is contained in:
commit
24238a3b3b
@ -1193,8 +1193,13 @@ $app->group('/tokens', 'APIrequest', function () use ($app, $app_template) {
|
|||||||
|
|
||||||
$currentTId = (int)$currentTId;
|
$currentTId = (int)$currentTId;
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
$tid = $sact->getThemeId(); // 取得此活動的主題
|
$tid = $sact->getThemeId(); // 取得此活動的主題
|
||||||
$maxItemTotal = $sact->getLearnStyle(); // 取得最大推薦數
|
$maxItemTotal = $sact->getLearnStyle(); // 取得最大推薦數
|
||||||
|
=======
|
||||||
|
// 取得此活動的主題
|
||||||
|
$tid = $sact->getThemeId();
|
||||||
|
>>>>>>> 345e83e160f83e726d8571e101f54f40a63b7a13
|
||||||
|
|
||||||
// 取得本次採用的教材風格
|
// 取得本次採用的教材風格
|
||||||
$materialMode = $sact->getMaterialStyle();
|
$materialMode = $sact->getMaterialStyle();
|
||||||
@ -1210,9 +1215,18 @@ $app->group('/tokens', 'APIrequest', function () use ($app, $app_template) {
|
|||||||
$result_recommand_total = $recommandTotal;
|
$result_recommand_total = $recommandTotal;
|
||||||
}
|
}
|
||||||
// 是否已經學完了
|
// 是否已經學完了
|
||||||
|
<<<<<<< HEAD
|
||||||
// TODO: 改以取得已學習標的數來判定
|
// TODO: 改以取得已學習標的數來判定
|
||||||
if($recommandTotal <= 0) { $isEnd = true; }
|
if($recommandTotal <= 0) { $isEnd = true; }
|
||||||
else { $isEnd = false; }
|
else { $isEnd = false; }
|
||||||
|
=======
|
||||||
|
if($sact->getRemainingPointTotal() <= 0) {
|
||||||
|
$isEnd = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$isEnd = false;
|
||||||
|
}
|
||||||
|
>>>>>>> 345e83e160f83e726d8571e101f54f40a63b7a13
|
||||||
|
|
||||||
// 製作
|
// 製作
|
||||||
$output_targets = array();
|
$output_targets = array();
|
||||||
|
@ -157,7 +157,7 @@ class DBStudyActivity extends Database {
|
|||||||
protected function queryActivityByWhere($where) {
|
protected function queryActivityByWhere($where) {
|
||||||
|
|
||||||
$sqlString = "SELECT `SaID`, `UID`, `ThID`, ".
|
$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`, ".
|
"WHERE `th`.`ThID` = `sa`.`ThID`) AS `ThName`, ".
|
||||||
"`StartTime`, ".
|
"`StartTime`, ".
|
||||||
"FROM_UNIXTIME(UNIX_TIMESTAMP(`StartTime`)+(`LearnTime`+`Delay`)*60)".
|
"FROM_UNIXTIME(UNIX_TIMESTAMP(`StartTime`)+(`LearnTime`+`Delay`)*60)".
|
||||||
@ -172,8 +172,7 @@ class DBStudyActivity extends Database {
|
|||||||
|
|
||||||
"(SELECT count(DISTINCT `TID`)
|
"(SELECT count(DISTINCT `TID`)
|
||||||
FROM `".$this->table('Study')."` AS `study`
|
FROM `".$this->table('Study')."` AS `study`
|
||||||
WHERE `Out_TargetTime` IS NOT NULL
|
WHERE `study`.`SaID` = `sa`.`SaID`) AS `LearnedTotal`".
|
||||||
AND `study`.`SaID` = `sa`.`SaID`) AS `LearnedTotal`".
|
|
||||||
|
|
||||||
"FROM `".$this->table('StudyActivity')."` AS sa ".
|
"FROM `".$this->table('StudyActivity')."` AS sa ".
|
||||||
"WHERE ".$where;
|
"WHERE ".$where;
|
||||||
@ -754,7 +753,7 @@ SELECT 'study' AS `Type`,
|
|||||||
`LMode`, `LModeForce`, `MMode`, `EnableVirtual`, '1' AS `Lock`,
|
`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(`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`
|
FROM `".$this->table('StudyActivity')."` AS `sa`
|
||||||
LEFT JOIN `".$this->table('Theme')."` AS `th`
|
LEFT JOIN `".$this->table('Theme')."` AS `th`
|
||||||
|
@ -30,7 +30,7 @@ class DBTheme extends Database {
|
|||||||
$sqlString = "SELECT `ThID`, `ThName`, ".
|
$sqlString = "SELECT `ThID`, `ThName`, ".
|
||||||
"`ThLearnTime`, `StartTID`, `ThIntroduction`, ".
|
"`ThLearnTime`, `StartTID`, `ThIntroduction`, ".
|
||||||
"`ThBuildTime`, `ThModifyTime`, ".
|
"`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`".
|
WHERE `belong`.`ThID` = `theme`.`ThID`) AS `TargetTotal`".
|
||||||
"FROM `".$this->table('Theme')."` AS `theme` ".
|
"FROM `".$this->table('Theme')."` AS `theme` ".
|
||||||
"WHERE ".$where;
|
"WHERE ".$where;
|
||||||
|
@ -163,11 +163,14 @@ class RecommandPoint
|
|||||||
"VirtualCost"=>$virtualCost));
|
"VirtualCost"=>$virtualCost));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(count($recommand) >= 1) {
|
||||||
|
|
||||||
foreach($recommand as $key=>$value)
|
foreach($recommand as $key=>$value)
|
||||||
{
|
{
|
||||||
$tmp[$key] = $value["PathCost"];
|
$tmp[$key] = $value["PathCost"];
|
||||||
}
|
}
|
||||||
array_multisort($tmp,SORT_DESC,$recommand,SORT_DESC);
|
array_multisort($tmp,SORT_DESC,$recommand,SORT_DESC);
|
||||||
|
}
|
||||||
|
|
||||||
return $recommand;
|
return $recommand;
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
|
@ -26,8 +26,8 @@ class StudyManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 取得目前已進入的學習點
|
* 取得目前已進入的學習點
|
||||||
* @param string $activity_id 活動編號
|
* @param int $activity_id 活動編號
|
||||||
* @return string 標的編號,若無則null
|
* @return int 標的編號,若無則null
|
||||||
*/
|
*/
|
||||||
public function getCurrentInTargetId($activity_id) {
|
public function getCurrentInTargetId($activity_id) {
|
||||||
|
|
||||||
|
@ -267,7 +267,7 @@ class Target {
|
|||||||
* @param int $number 學習標的目前人數
|
* @param int $number 學習標的目前人數
|
||||||
* @since 2.0.0
|
* @since 2.0.0
|
||||||
*/
|
*/
|
||||||
function setMj($number){
|
public function setMj($number){
|
||||||
$this->setUpdate('Mj', $number);
|
$this->setUpdate('Mj', $number);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -280,7 +280,7 @@ class Target {
|
|||||||
* @return int 學習標的目前人數
|
* @return int 學習標的目前人數
|
||||||
* @since 2.0.0
|
* @since 2.0.0
|
||||||
*/
|
*/
|
||||||
function addMj($number){
|
public function addMj($number){
|
||||||
$setedNum = $this->queryResultArray['Mj']+$number;
|
$setedNum = $this->queryResultArray['Mj']+$number;
|
||||||
if($setedNum < 0) $setedNum = 0;
|
if($setedNum < 0) $setedNum = 0;
|
||||||
$this->setUpdate('Mj', $setedNum);
|
$this->setUpdate('Mj', $setedNum);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user