I noticed that the value field in the {votingapi_cache} table is of type float, but the value inserted was always an integer!

I tracked it down to the query rewrite using %d instead of %f. If you change to %f, you'll get floats in the db.

Old way:

  db_query("INSERT INTO {votingapi_cache} (vote_cache_id, content_type, content_id, value, value_type, tag, function) VALUES (%d, '%s', %d, %d, '%s', '%s', '%s')",
    $vobj->vote_cache_id, $vobj->content_type, $vobj->content_id, $vobj->value, $vobj->value_type, $vobj->tag, $vobj->function);

New way:

  db_query("INSERT INTO {votingapi_cache} (vote_cache_id, content_type, content_id, value, value_type, tag, function) VALUES (%d, '%s', %d, %f, '%s', '%s', '%s')",
    $vobj->vote_cache_id, $vobj->content_type, $vobj->content_id, $vobj->value, $vobj->value_type, $vobj->tag, $vobj->function);

Other than that, it's a great module :)

Comments

eaton’s picture

This appears to be fixed in the current CVS version, as well as the 4.7 branch. Can you get a copy of the latest version and see if the issue is still present?

datura-1’s picture

I've confirmed that it is indeed fixed in the CVS version. Thanks!

eaton’s picture

Status: Active » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)