Skip to content

Commit

Permalink
4.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelbart committed Sep 14, 2020
1 parent 00ecf85 commit 6a7833d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
19 changes: 13 additions & 6 deletions core/helpers/class-stats.php
Original file line number Diff line number Diff line change
Expand Up @@ -1289,14 +1289,21 @@ public static function get_recently_contra( $limit = null )
public static function get_single_post_stats( $post_id )
{
$post = get_post( $post_id );
$pro = self::get_pro( $post->ID ) ? self::get_pro( $post->ID ) : 0;
$contra = self::get_contra( $post->ID ) ? self::get_contra( $post->ID ) : 0;
$pro = self::get_pro( $post->ID ) ? intval( self::get_pro( $post->ID ) ) : 0;
$contra = self::get_contra( $post->ID ) ? intval( self::get_contra( $post->ID ) ) : 0;
$prop = self::get_pro( $post->ID, true );
$conp = self::get_contra( $post->ID, true );
$average = (int) ( $pro - $contra );
$total = (int) ( $pro + $contra );
$percentage = ( $pro / $total ) * 100;
$percentage = round( $percentage, 2 );

$average = 0;
$total = 0;
$percentage = 0;

if ( 0 !== $pro ) {
$average = (int) ( $pro - $contra );
$total = (int) ( $pro + $contra );
$percentage = ( $pro / $total ) * 100;
$percentage = round( $percentage, 2 );
}

$post_type = get_post_type_object( $post->post_type );

Expand Down
2 changes: 1 addition & 1 deletion helpful.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Plugin Name: Helpful
* Description: Add a fancy feedback form under your posts or post-types and ask your visitors a question. Give them the abbility to vote with yes or no.
* Version: 4.4.0
* Version: 4.4.1
* Author: Pixelbart
* Author URI: https://pixelbart.de
* Text Domain: helpful
Expand Down
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Tags: helpful, poll, feedback, reviews, vote, review, voting
Requires at least: 4.6
Tested up to: 5.6
Requires PHP: 5.6.20
Stable tag: 4.4.0
Stable tag: 4.4.1
License: MIT License
License URI: https://opensource.org/licenses/MIT

Expand Down

0 comments on commit 6a7833d

Please sign in to comment.