將陣列回傳(2D)改成1D Array回傳 in DBRecommand.php

This commit is contained in:
kobayashi 2015-01-17 03:36:05 +08:00
parent c75ad9a358
commit 0fd277cfc6
2 changed files with 5 additions and 3 deletions

View File

@ -82,7 +82,7 @@ class DBRecommand extends Database
$whereClause = $this->table('TBelong').".ThID = ".$this->connDB->quote($theme_number)." AND ".$this->table('TBelong').".TID = ".$this->connDB->quote($next_point);
$AllOfResult = $this->queryBelongByWhere($whereClause);
if(count($AllOfResult) != 0) return $AllOfResult;
if(count($AllOfResult) != 0) return $AllOfResult[0];
else return null;
}

View File

@ -6,6 +6,8 @@ require_once UELEARNING_ROOT.'/config.php';
require_once UELEARNING_LIB_ROOT.'/Target/Target.php';
require_once UELEARNING_LIB_ROOT.'/Database/DBRecommand.php';
require_once UELEARNING_LIB_ROOT.'/Study/Theme.php';
require_once UELEARNING_LIB_ROOT.'/Study/Study.php';
require_once UELEARNING_LIB_ROOT.'/Study/StudyActivity.php';
use UElearning\Target;
use UElearning\Study;
use UElearning\Database;
@ -47,7 +49,7 @@ class RecommandPoint
* 計算正規化參數
* @return double 正規化參數
*/
private function computeNormalizationParameter($theme_number)
public function computeNormalizationParameter($theme_number)
{
$normal = 0; //正規化之後的GAMMA值
$EntitySum = 0; //實體學習點分別算銓重之後的值
@ -62,7 +64,7 @@ class RecommandPoint
$move_time = $edge[$i]["move_time"];
$next_target = new Target\Target($next_point);
$belong = $this->recommand->queryBelongByID($next_point,$theme->getId());
$weight = $belong[0]["weight"];
$weight = $belong["weight"];
$VirtualSum += $weight / $next_target->getLearnTime();