diff --git a/htdocs/lib/Database/DBRecommand.php b/htdocs/lib/Database/DBRecommand.php index 2f6241c..043a28d 100644 --- a/htdocs/lib/Database/DBRecommand.php +++ b/htdocs/lib/Database/DBRecommand.php @@ -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; } diff --git a/htdocs/lib/Recommand/RecommandPoint.php b/htdocs/lib/Recommand/RecommandPoint.php index 3c23759..6f763a1 100644 --- a/htdocs/lib/Recommand/RecommandPoint.php +++ b/htdocs/lib/Recommand/RecommandPoint.php @@ -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();