From 0fd277cfc6d10c8905b3b1e18931e239112d1c77 Mon Sep 17 00:00:00 2001 From: kobayashi <3011850@gmail.com> Date: Sat, 17 Jan 2015 03:36:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=87=E9=99=A3=E5=88=97=E5=9B=9E=E5=82=B3(2?= =?UTF-8?q?D)=E6=94=B9=E6=88=901D=20Array=E5=9B=9E=E5=82=B3=20in=20DBRecom?= =?UTF-8?q?mand.php?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/lib/Database/DBRecommand.php | 2 +- htdocs/lib/Recommand/RecommandPoint.php | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) 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();