Common subdirectories: userpoints/po and userpoints.new/po Common subdirectories: userpoints/tests and userpoints.new/tests Common subdirectories: userpoints/translations and userpoints.new/translations diff -up userpoints/userpoints.info userpoints.new/userpoints.info --- userpoints/userpoints.info 2009-03-29 20:24:24.000000000 -0400 +++ userpoints.new/userpoints.info 2009-02-17 19:23:48.000000000 -0500 @@ -4,9 +4,9 @@ description = Users earn points as they package = Userpoints core = 6.x -; Information added by drupal.org packaging script on 2009-03-30 +; Information added by drupal.org packaging script on 2009-02-18 version = "6.x-1.x-dev" core = "6.x" project = "userpoints" -datestamp = "1238372664" +datestamp = "1234916628" diff -up userpoints/userpoints.install userpoints.new/userpoints.install --- userpoints/userpoints.install 2009-03-29 15:13:04.000000000 -0400 +++ userpoints.new/userpoints.install 2009-03-29 16:05:44.000000000 -0400 @@ -1,5 +1,5 @@ 'int', 'not null' => TRUE, 'default' => 0, 'length' => 10)); - db_change_field($ret, 'userpoints', 'points', 'points', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'length' => 10)); + db_add_field($ret, 'userpoints', 'max_points', array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'lenght' => 10)); + db_change_field($ret, 'userpoints', 'points', 'points', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'lenght' => 10)); return $ret; } @@ -192,22 +192,22 @@ function userpoints_update_3() { function userpoints_update_4() { $ret = array(); - db_change_field($ret, 'userpoints_txn', 'event', 'event', array('type' => 'varchar', 'length' => 32 )); + db_change_field($ret, 'userpoints_txn', 'event', 'event', array('type' => 'varchar', 'lenght' => 32 )); db_change_field($ret, 'userpoints_txn', 'status', 'status', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0 )); return $ret; } function userpoints_update_5() { $ret = array(); - db_add_field($ret, 'userpoints_txn', 'reference', array('type' => 'varchar', 'length' => 128)); + db_add_field($ret, 'userpoints_txn', 'reference', array('type' => 'varchar', 'lenght' => 128)); db_add_index($ret, 'userpoints_txn', 'reference', array('reference')); return $ret; } function userpoints_update_6() { $ret = array(); - db_add_field($ret, 'userpoints_txn', 'expirydate', array('type' => 'int', 'length' => 11, 'not null' => true)); - db_add_field($ret, 'userpoints_txn', 'expired', array('type' => 'int', 'length' => 1, 'not null' => true, 'size' => 'tiny')); + db_add_field($ret, 'userpoints_txn', 'expirydate', array('type' => 'int', 'lenght' => 11, 'not null' => true)); + db_add_field($ret, 'userpoints_txn', 'expired', array('type' => 'int', 'lenght' => 1, 'not null' => true, 'size' => 'tiny')); db_add_field($ret, 'userpoints_txn', 'parent_txn_id', array('type' => 'int')); db_add_field($ret, 'userpoints_txn', 'tid', array('type' => 'int')); @@ -220,15 +220,15 @@ function userpoints_update_6() { } function userpoints_update_7() { $ret = array(); - db_add_field($ret, 'userpoints_txn', 'entity_id', array('type' => 'int', 'length' => 11, 'not null' => true)); - db_add_field($ret, 'userpoints_txn', 'entity_type', array('type' => 'varchar', 'length' => 32)); + db_add_field($ret, 'userpoints_txn', 'entity_id', array('type' => 'int', 'lenght' => 11, 'not null' => true)); + db_add_field($ret, 'userpoints_txn', 'entity_type', array('type' => 'varchar', 'lenght' => 32)); db_change_field($ret, 'userpoints_txn', 'event', 'operation', array('type' => 'varchar')); return $ret; } function userpoints_update_8() { $ret = array(); - db_change_field($ret, 'userpoints_txn', 'tid', 'tid', array('type' => 'int', 'not null' => true, 'default' => 0, 'length' => 11)); - db_change_field($ret, 'userpoints', 'tid', 'tid', array('type' => 'int', 'not null' => true, 'default' => 0, 'length' => 11)); + db_change_field($ret, 'userpoints_txn', 'tid', 'tid', array('type' => 'int', 'not null' => true, 'default' => 0, 'lenght' => 11)); + db_change_field($ret, 'userpoints', 'tid', 'tid', array('type' => 'int', 'not null' => true, 'default' => 0, 'lenght' => 11)); return $ret; } @@ -243,3 +243,16 @@ function userpoints_update_6010() { $ret[] = update_sql("UPDATE {permission} SET perm = REPLACE(perm, 'admin userpoints', 'administer userpoints') WHERE perm LIKE '%admin userpoints%'"); return $ret; } + +function userpoints_update_6011() { + $ret = array(); + db_change_field($ret, 'userpoints_txn', 'points', 'points', array('type' => 'float', 'not null' => true, 'default' => 0)); + db_change_field($ret, 'userpoints', 'points', 'points', array('type' => 'float', 'not null' => true, 'default' => 0)); + db_change_field($ret, 'userpoints', 'max_points', 'max_points', array('type' => 'float', 'not null' => true, 'default' => 0)); + return $ret; +} + + + + + diff -up userpoints/userpoints.module userpoints.new/userpoints.module --- userpoints/userpoints.module 2009-02-17 10:21:23.000000000 -0500 +++ userpoints.new/userpoints.module 2009-03-29 22:07:27.000000000 -0400 @@ -440,9 +440,9 @@ function userpoints_get_current_points($ $tid = userpoints_get_default_tid(); } elseif ($tid == 'all') { - return (int)db_result(db_query('SELECT SUM(points) FROM {userpoints} WHERE uid = %d', $uid)); + return (float)db_result(db_query('SELECT SUM(points) FROM {userpoints} WHERE uid = %d', $uid)); } - return (int)db_result(db_query('SELECT points FROM {userpoints} WHERE uid = %d AND tid = %d', $uid, $tid)); + return (float)db_result(db_query('SELECT SUM(points) FROM {userpoints} WHERE uid = %d AND tid = %d', $uid, $tid)); } /** @@ -459,9 +459,9 @@ function userpoints_get_max_points($uid $tid = userpoints_get_default_tid(); } elseif ($tid == 'all') { - return (int)db_result(db_query('SELECT SUM(max_points) FROM {userpoints} WHERE uid = %d', $uid)); + return (float)db_result(db_query('SELECT SUM(max_points) FROM {userpoints} WHERE uid = %d', $uid)); } - return (int)db_result(db_query('SELECT max_points FROM {userpoints} WHERE uid = %d AND tid = %d', $uid, $tid)); + return (float)db_result(db_query('SELECT max_points FROM {userpoints} WHERE uid = %d AND tid = %d', $uid, $tid)); } /** @@ -709,7 +709,7 @@ function _userpoints_transaction(&$param $ret = db_query("INSERT INTO {userpoints_txn} (uid, points, time_stamp, status, operation, description, reference, expirydate, expired, parent_txn_id, tid, entity_id, entity_type) - VALUES (%d, %d, %d, %d, '%s', '%s', '%s', %d, %d, %d, %d, %d, '%s')", + VALUES (%d, %f, %d, %d, '%s', '%s', '%s', %d, %d, %d, %d, %d, '%s')", $params['uid'], $params['points'], time(), @@ -744,19 +744,19 @@ function _userpoints_update_cache(&$para } // Calculate the current points based upon the tid - $current_points = (int)$params['points'] + userpoints_get_current_points($params['uid'], $params['tid']); + $current_points = (float)$params['points'] + userpoints_get_current_points($params['uid'], $params['tid']); //Grab the user's maximum points to preserve it $max_points = db_result(db_query('SELECT max_points FROM {userpoints} WHERE uid = %d AND tid = %d', $params['uid'], $params['tid'])); if ($params['points'] > 0) { //points are greater than zero, update their max_points - $max_points = (int)$params['points'] + (int)$max_points; + $max_points = (float)$params['points'] + (float)$max_points; } // insert or update the userpoints caching table with the user's current points if (_userpoints_user_exists($params['uid'], $params['tid'])) { db_query("UPDATE {userpoints} - SET points = %d, max_points = %d, last_update = %d + SET points = %f, max_points = %f, last_update = %d WHERE uid = %d AND tid = %d", $current_points, $max_points, @@ -768,7 +768,7 @@ function _userpoints_update_cache(&$para else { $result = db_query("INSERT INTO {userpoints} (uid, points, max_points, last_update, tid) - VALUES (%d, %d, %d, %d, %d )", + VALUES (%d, %f, %f, %d, %d )", $params['uid'], $current_points, $max_points, @@ -1474,7 +1474,7 @@ function userpoints_block($op = 'list', if ($delta == -1) { $title = t('@user\'s !points', array_merge(array('@user' => $user->name), userpoints_translation()));; if ($user->uid) { - $points = (int) db_result(db_query('SELECT points FROM {userpoints} WHERE uid = %d', $user->uid)); + $points = (float) db_result(db_query('SELECT points FROM {userpoints} WHERE uid = %d', $user->uid)); $show_points = format_plural($points, '!point', '!points', userpoints_translation()); $content = t('You have %p %c', array('%p' => $points, '%c' => $show_points)); } diff -up userpoints/userpoints_rules.info userpoints.new/userpoints_rules.info --- userpoints/userpoints_rules.info 2009-03-29 20:24:24.000000000 -0400 +++ userpoints.new/userpoints_rules.info 2009-02-17 19:23:48.000000000 -0500 @@ -6,9 +6,9 @@ dependencies[] = rules package = Userpoints core = 6.x -; Information added by drupal.org packaging script on 2009-03-30 +; Information added by drupal.org packaging script on 2009-02-18 version = "6.x-1.x-dev" core = "6.x" project = "userpoints" -datestamp = "1238372664" +datestamp = "1234916628" Only in userpoints: userpoints_service.info Only in userpoints: userpoints_service.module