Version 5.0.6
This commit is contained in:
1 parent
a3a4a9ccbd
commit
b89858b2ff
1214 files changed
+92828
-14859
No files matched your search
@@ -161,7 +161,7 @@ class AnswerMarkedBest extends AchievementActionAbstract
|
||||
*/
|
||||
public function awardOther( mixed $extra = NULL, ?array $filters = NULL ): array
|
||||
{
|
||||
return [ $extra->item()->author() ];
|
||||
return [ $extra['post']->item()->author() ];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -303,6 +303,6 @@ class AnswerMarkedBest extends AchievementActionAbstract
|
||||
public static function rebuildRow( array $row, array $data ) : void
|
||||
{
|
||||
$post = Post::load( $row['comment_id'] );
|
||||
$post->author()->achievementAction( 'forums', 'AnswerMarkedBest', $post, DateTime::ts( $row[ $data['date'] ] ) );
|
||||
$post->author()->achievementAction( 'forums', 'AnswerMarkedBest', [ 'post' => $post, 'type' => $data['type'] ], DateTime::ts( $row[ $data['date'] ] ) );
|
||||
}
|
||||
}
|
||||
@@ -127,7 +127,6 @@ class RebuildSolvedStats extends QueueAbstract
|
||||
[ Db::i()->in( 'approved', array( -2, -3 ), TRUE ) ],
|
||||
[ 'forum_id=?', $forum->_id ],
|
||||
[ 'start_date > ? AND start_date < ?', $start->getTimestamp(), $end->getTimestamp() ],
|
||||
[ 'type=?', 'solved' ]
|
||||
];
|
||||
|
||||
|
||||
|
||||
@@ -47,24 +47,19 @@ class PercentageSolved extends \IPS\core\Statistics\Chart
|
||||
*/
|
||||
public function getChart( Url $url ): Chart
|
||||
{
|
||||
/* Determine minimum date */
|
||||
$minimumDate = NULL;
|
||||
|
||||
/* Determine minimum date - if there is nothing, set it to today */
|
||||
$minimumDate = Db::i()->select( 'min(solved_date)', 'core_solved_index' )->first();
|
||||
$minimumDate = $minimumDate ? DateTime::ts( $minimumDate ) : DateTime::create();
|
||||
|
||||
/* We can't retrieve any stats prior to the new tracking being implemented */
|
||||
try
|
||||
$oldestLog = Db::i()->select( 'MIN(time)', 'core_statistics', array( 'type=?', 'solved' ) )->first();
|
||||
if( $oldestLog )
|
||||
{
|
||||
$oldestLog = Db::i()->select( 'MIN(time)', 'core_statistics', array( 'type=?', 'solved' ) )->first();
|
||||
|
||||
if( !$minimumDate OR $oldestLog < $minimumDate->getTimestamp() )
|
||||
if( $oldestLog < $minimumDate->getTimestamp() )
|
||||
{
|
||||
$minimumDate = DateTime::ts( $oldestLog );
|
||||
}
|
||||
}
|
||||
catch( UnderflowException $e )
|
||||
{
|
||||
/* We have nothing tracked, set minimum date to today */
|
||||
$minimumDate = DateTime::create();
|
||||
}
|
||||
|
||||
$chart = new Database( $url, 'core_statistics', 'time', '', array(
|
||||
'isStacked' => FALSE,
|
||||
|
||||
@@ -50,24 +50,19 @@ class SolvedByForum extends \IPS\core\Statistics\Chart
|
||||
*/
|
||||
public function getChart( Url $url ): Chart
|
||||
{
|
||||
/* Determine minimum date */
|
||||
$minimumDate = NULL;
|
||||
/* Determine minimum date - if there is nothing, set it to today */
|
||||
$minimumDate = Db::i()->select( 'min(solved_date)', 'core_solved_index' )->first();
|
||||
$minimumDate = $minimumDate ? DateTime::ts( $minimumDate ) : DateTime::create();
|
||||
|
||||
/* We can't retrieve any stats prior to the new tracking being implemented */
|
||||
try
|
||||
$oldestLog = Db::i()->select( 'MIN(time)', 'core_statistics', array( 'type=?', 'solved' ) )->first();
|
||||
if( $oldestLog )
|
||||
{
|
||||
$oldestLog = Db::i()->select( 'MIN(time)', 'core_statistics', array( 'type=?', 'solved' ) )->first();
|
||||
|
||||
if( !$minimumDate OR $oldestLog < $minimumDate->getTimestamp() )
|
||||
if( $oldestLog < $minimumDate->getTimestamp() )
|
||||
{
|
||||
$minimumDate = DateTime::ts( $oldestLog );
|
||||
}
|
||||
}
|
||||
catch( UnderflowException $e )
|
||||
{
|
||||
/* We have nothing tracked, set minimum date to today */
|
||||
$minimumDate = DateTime::create();
|
||||
}
|
||||
|
||||
$chart = new Database( $url, 'core_solved_index', 'solved_date', '', array(
|
||||
'isStacked' => FALSE,
|
||||
@@ -80,7 +75,7 @@ class SolvedByForum extends \IPS\core\Statistics\Chart
|
||||
),
|
||||
'LineChart',
|
||||
'monthly',
|
||||
array( 'start' => ( new DateTime )->sub( new DateInterval('P90D') ), 'end' => new DateTime ),
|
||||
array( 'start' => $minimumDate, 'end' => new DateTime ),
|
||||
array(),
|
||||
'solved'
|
||||
);
|
||||
|
||||
@@ -11,15 +11,14 @@
|
||||
namespace IPS\forums\extensions\core\Statistics;
|
||||
|
||||
use IPS\core\Statistics\Chart as ParentClass;
|
||||
use IPS\DateTime;
|
||||
use IPS\Db;
|
||||
use IPS\Helpers\Chart;
|
||||
use IPS\Helpers\Chart\Database as DbChart;
|
||||
use IPS\Helpers\Form\Select;
|
||||
use IPS\Http\Url;
|
||||
use IPS\DateTime as IPSDateTime;
|
||||
use IPS\Member;
|
||||
use IPS\Member\Group;
|
||||
use UnderflowException;
|
||||
use DateInterval;
|
||||
|
||||
use function defined;
|
||||
@@ -52,24 +51,19 @@ class SolvedByGroup extends ParentClass
|
||||
*/
|
||||
public function getChart( Url $url ): Chart
|
||||
{
|
||||
/* Determine minimum date */
|
||||
$minimumDate = NULL;
|
||||
|
||||
/* Determine minimum date - if there is nothing, set it to today */
|
||||
$minimumDate = Db::i()->select( 'min(solved_date)', 'core_solved_index' )->first();
|
||||
$minimumDate = $minimumDate ? DateTime::ts( $minimumDate ) : DateTime::create();
|
||||
|
||||
/* We can't retrieve any stats prior to the new tracking being implemented */
|
||||
try
|
||||
$oldestLog = Db::i()->select( 'MIN(time)', 'core_statistics', array( 'type=?', 'solved' ) )->first();
|
||||
if( $oldestLog )
|
||||
{
|
||||
$oldestLog = Db::i()->select( 'MIN(time)', 'core_statistics', array( 'type=?', 'solved' ) )->first();
|
||||
|
||||
if( !$minimumDate OR $oldestLog < $minimumDate->getTimestamp() )
|
||||
if( $oldestLog < $minimumDate->getTimestamp() )
|
||||
{
|
||||
$minimumDate = IPSDateTime::ts( $oldestLog );
|
||||
$minimumDate = DateTime::ts( $oldestLog );
|
||||
}
|
||||
}
|
||||
catch( UnderflowException $e )
|
||||
{
|
||||
/* We have nothing tracked, set minimum date to today */
|
||||
$minimumDate = IPSDateTime::create();
|
||||
}
|
||||
|
||||
$chart = new DbChart( $url, 'core_solved_index', 'solved_date', '', array(
|
||||
'isStacked' => FALSE,
|
||||
@@ -82,7 +76,7 @@ class SolvedByGroup extends ParentClass
|
||||
),
|
||||
'LineChart',
|
||||
'monthly',
|
||||
array( 'start' => ( new IPSDateTime )->sub( new DateInterval('P90D') ), 'end' => new IPSDateTime ),
|
||||
array( 'start' => $minimumDate, 'end' => new DateTime ),
|
||||
array(),
|
||||
'solved'
|
||||
);
|
||||
|
||||
@@ -47,24 +47,19 @@ class TimeSolved extends \IPS\core\Statistics\Chart
|
||||
*/
|
||||
public function getChart( Url $url ): Chart
|
||||
{
|
||||
/* Determine minimum date */
|
||||
$minimumDate = NULL;
|
||||
|
||||
/* Determine minimum date - if there is nothing, set it to today */
|
||||
$minimumDate = Db::i()->select( 'min(solved_date)', 'core_solved_index' )->first();
|
||||
$minimumDate = $minimumDate ? DateTime::ts( $minimumDate ) : DateTime::create();
|
||||
|
||||
/* We can't retrieve any stats prior to the new tracking being implemented */
|
||||
try
|
||||
$oldestLog = Db::i()->select( 'MIN(time)', 'core_statistics', array( 'type=?', 'solved' ) )->first();
|
||||
if( $oldestLog )
|
||||
{
|
||||
$oldestLog = Db::i()->select( 'MIN(time)', 'core_statistics', array( 'type=?', 'solved' ) )->first();
|
||||
|
||||
if( $oldestLog !== null and ( !$minimumDate OR $oldestLog < $minimumDate->getTimestamp() ) )
|
||||
if( $oldestLog < $minimumDate->getTimestamp() )
|
||||
{
|
||||
$minimumDate = DateTime::ts( $oldestLog );
|
||||
}
|
||||
}
|
||||
catch( UnderflowException $e )
|
||||
{
|
||||
/* We have nothing tracked, set minimum date to today */
|
||||
$minimumDate = DateTime::create();
|
||||
}
|
||||
|
||||
$chart = new Database( $url, 'core_statistics', 'time', '', array(
|
||||
'isStacked' => FALSE,
|
||||
|
||||
Reference in new issue
Block a user