--- a/models/opiniarbo_model.php Sun Dec 28 16:57:53 2008 +0000
+++ b/models/opiniarbo_model.php Sun Dec 28 17:20:55 2008 +0000
@@ -207,7 +207,7 @@
function recalc_user_influences($user,$parent)
{
- $this->db->select('values.id,values.influence');
+ $this->db->select('values.id as vid,asertoj.id,values.influence');
$this->db->from('values');
$this->db->join('asertoj','values.assertion = asertoj.id');
$this->db->where('asertoj.parent',$parent);
@@ -235,7 +235,7 @@
if ($parent != NULL)
{
$newinfluence = $row['influence'] / $sum_influence;
- $query2 = $this->db->where('id', $row['id']);
+ $query2 = $this->db->where('id', $row['vid']);
$query2->update('values', array(
'influence' => $newinfluence));
}
@@ -246,7 +246,7 @@
function get_user_calc_value($user, $parent, $orig_value)
{
- $this->db->select('values.id,values.value,values.influence');
+ $this->db->select('asertoj.id,values.id as vid,values.value,values.influence');
$this->db->from('values');
$this->db->join('asertoj','values.assertion = asertoj.id');
$this->db->where('asertoj.parent',$parent);
@@ -278,9 +278,9 @@
// and the proper value to those with subassertions.
if ($parent != NULL)
{
- $query2 = $this->db->where('id', $parent);
- $query2->update('values', array(
- 'calc_value' => $val, 'user' => $user));
+ $query2 = $this->db->where('assertion', $parent);
+ $query2 = $this->db->where('user', $user);
+ $query2->update('values', array('calc_value' => $val));
}
if ($val == NULL)
--- a/views/assertions.php Sun Dec 28 16:57:53 2008 +0000
+++ b/views/assertions.php Sun Dec 28 17:20:55 2008 +0000
@@ -1,5 +1,7 @@
-<?php if(isset($title))
+<?php
+if(isset($title))
echo "<h2>$title</h2>";
+
?>
<table border=1>
<tr>
@@ -48,16 +50,18 @@
$influence1 = $assertion['influence1'];
else
$influence1 = "";
- echo "<td><input type=\"text\" name=\"influence\" id=\"influence\" value=\"{$influence1}\" maxlength=\"5\" size=\"3\" />";
+ echo "<td><input type=\"text\" name=\"influence\" id=\"influence\" value=\"".
+ sprintf("%2.2f", $influence1)."\" maxlength=\"5\" size=\"3\" />";
}
else
echo "<td>";
}
- echo "<td><input type=\"text\" name=\"value\" id=\"value\" value=\"{$value1}\" maxlength=\"5\" size=\"3\" />";
+ echo "<td><input type=\"text\" name=\"value\" id=\"value\" value=\"".
+ sprintf("%2.2f", $value1)."\" maxlength=\"5\" size=\"3\" />";
if (isset($assertion['calc_value1']))
- echo "<td>{$assertion['calc_value1']}";
+ echo "<td>".sprintf("%2.2f", $assertion['calc_value1']);
else
echo "<td>";
@@ -69,19 +73,19 @@
$influence2 = $assertion['influence2'];
else
$influence2 = "";
- echo "<td>{$influence2}";
+ echo "<td>".sprintf("%2.2f", $influence2);
}
else
echo "<td>";
}
if (isset($assertion['value2']))
- echo "<td>{$assertion['value2']}";
+ echo "<td>".sprintf("%2.2f", $assertion['value2']);
else
echo "<td>";
if (isset($assertion['calc_value2']))
- echo "<td>{$assertion['value2']}";
+ echo "<td>".sprintf("%2.2f", $assertion['calc_value2']);
else
echo "<td>";
echo "<td>" . anchor("opiniarbo/index/{$assertion['id']}/{$other_user}",