From: niekt0 Date: Tue, 15 Mar 2011 00:24:41 +0000 (+0100) Subject: k_neurons another fix. X-Git-Url: https://git.harvie.cz/?a=commitdiff_plain;h=62f1482a23dd3d917924fd2782728410728baf78;p=mirrors%2FKyberia-bloodline.git k_neurons another fix. --- diff --git a/wwwroot/backend/mysql/backend.inc b/wwwroot/backend/mysql/backend.inc index ebc9337..55e633f 100644 --- a/wwwroot/backend/mysql/backend.inc +++ b/wwwroot/backend/mysql/backend.inc @@ -326,19 +326,19 @@ function setParent($node_id,$parent_id) { return 0; } -// XXX TODO -// +// Get nodes sorted by weight_k specific to user function getKNeurons($user_id,$interval) { global $db,$node,$error,$error_messages; $q="call k_neurons('$user_id','$interval')"; $set=$db->query($q); -// $set->next(); - return $set; -} - + while ($set->next()) { + $k_array[]=$set->getRecord(); + } + return $k_array; } +} diff --git a/wwwroot/backend/mysql/functions.sql b/wwwroot/backend/mysql/functions.sql index 14bb0f5..801dc83 100644 --- a/wwwroot/backend/mysql/functions.sql +++ b/wwwroot/backend/mysql/functions.sql @@ -37,7 +37,7 @@ END// create procedure k_neurons ( IN user_id INT, IN day_int INT) BEGIN if day_int = NULL or day_int = 0 then set day_int=20; end if; - select *,(k_get_node_weigth(node_id,user_id)*k) as weight_k from nodes where k>0 + select *,(k_get_node_weigth(node_id,user_id)*k) as weight_k,'test1' as creator,'test2' as parent from nodes where k>0 and node_created>now()-interval day_int day order by weight_k desc; END// diff --git a/wwwroot/inc/smarty/node_methodz/function.get_k_neurons.php b/wwwroot/inc/smarty/node_methodz/function.get_k_neurons.php index ba04b1a..dc28c9c 100644 --- a/wwwroot/inc/smarty/node_methodz/function.get_k_neurons.php +++ b/wwwroot/inc/smarty/node_methodz/function.get_k_neurons.php @@ -18,11 +18,9 @@ function smarty_function_get_k_neurons($params,&$smarty) { } else {$vector="00";} - $set=nodes::getKNeurons($params['user_id'],20); // XXX offset + // XXX offset + id $params['user_id'] + $k_array=nodes::getKNeurons(904,20); - while ($set->next()) { - $k_array[]=$set->getRecord(); - } $smarty->assign('get_k_neurons',$k_array); }