How to use Statistics 24h Points, 7 days Points update?

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Russoll wrote:

      change the time in the cron.php i.e StatisticCronjob.class...which is in the included/classes/cronjob
      I know exactly where he is.
      I ask your logic, how am I supposed to go?
    • Kaizoku wrote:

      or add in uni1_statpoints `total_old24_points` `total_old7_points` and add point every 24hour/7days
      Oke thanks.
      I did add a detailed work.
      She wanted a detail, but I got it, thanks.
    • Kaizoku wrote:

      or add in uni1_statpoints `total_old24_points` `total_old7_points` and add point every 24hour/7days
      Thats not possible, or how should those values be reset? To set the accurate points of the exact last 7 days you either have to save the new points every hour with a timestamp and then you calculate the last 7 days of your sql entries or (a bit less accurate but way more efficient lol) you create 2 new values like "7_days_old_points / 7_days_new_points and you create a cronjob for every 7 days which sets the new points variable to 0 and resets the old 7 points variable with the new one. Of course the new points variable must be updated every time when statpoints cronjob occurs. So the new_points variable is updating your current week status and the old value is showing the last weeks point jump.
    • XenQen wrote:

      Kaizoku wrote:

      or add in uni1_statpoints `total_old24_points` `total_old7_points` and add point every 24hour/7days
      Thats not possible, or how should those values be reset? To set the accurate points of the exact last 7 days you either have to save the new points every hour with a timestamp and then you calculate the last 7 days of your sql entries or (a bit less accurate but way more efficient lol) you create 2 new values like "7_days_old_points / 7_days_new_points and you create a cronjob for every 7 days which sets the new points variable to 0 and resets the old 7 points variable with the new one. Of course the new points variable must be updated every time when statpoints cronjob occurs. So the new_points variable is updating your current week status and the old value is showing the last weeks point jump.
      it s simple, just rewrite `total_old24_points` each 24hour 1 times, u can save last rewrite time in confiig table, and if 24points_time>TIMESTAMP-60*60*24 $total_old24_points = $points
    • XenQen wrote:

      Kaizoku wrote:

      or add in uni1_statpoints `total_old24_points` `total_old7_points` and add point every 24hour/7days
      Thats not possible, or how should those values be reset? To set the accurate points of the exact last 7 days you either have to save the new points every hour with a timestamp and then you calculate the last 7 days of your sql entries or (a bit less accurate but way more efficient lol) you create 2 new values like "7_days_old_points / 7_days_new_points and you create a cronjob for every 7 days which sets the new points variable to 0 and resets the old 7 points variable with the new one. Of course the new points variable must be updated every time when statpoints cronjob occurs. So the new_points variable is updating your current week status and the old value is showing the last weeks point jump.

      The algorithm is as follows.
      Daily change and 7-day change score are written for buildings and other species.
      The daily and 7-day last update time is added and the difference between the previous change and the new score is added until the time of daily change.
      Daily is also reset when the time is up.
    • suggestions

      you could modify statsbuilder with something like follows, add the columns in the statstable and also adding them in the sql requests in statsbuilder
      if($time_to_update === true){
      $UserData['old_tech'] = $UserData['id']]['techno']['points'];
      $UserData['old_build'] = $UserPoints[$UserData['id']]['build']['points'];
      $UserData['old_defs'] =$UserPoints[$UserData['id']]['defense']['points'];
      $UserData['old_fleet'] = $UserPoints[$UserData['id']]['fleet']['points'];
      $UserData['old_ress'] = $UserPoints[$UserData['id']]['ress']['points'];
      $UserData['old_total'] = ($UserPoints[$UserData['id']]['total']['points'];
      $UserData['old_tech_rank'] = $UserData['tech_rank'];
      $UserData['old_build_rank'] = $UserData['build_rank'];
      $UserData['old_defs_rank'] = $UserData['defs_rank'];
      $UserData['old_fleet_rank'] = $UserData['fleet_rank'];
      $UserData['old_ress_rank'] = $UserData['ress_rank'];
      $UserData['old_total_rank'] = $UserData['total_rank'];
      }

      then add an column in configtable like "next_weekstat_time" , "next_daystat_time" and update it, while setting $time_to_update to true,
      like this you always have the time of the last update, so you can easiely find out if it's time to update
      something like $newtime = strtotime('next monday');
      also can set last updatetime like this to show it in stats
      and then modiy statspage to show them

      --------------------------------------------------------------------------

      other most easy way would be 2 cronjobs similar to statscron just different time and different statsbuilderfile,
      make 2more class.statsbuilder.php, and change all %%STATPOINTS%% to %%STATPOINTS_DAY%% or %%STATPOINTS_WEEK%%
      then duplicate statstable in db 2 times with name for day and week insert them in dbtables.php
      then get them with joinrequet to print them in stats-template,
      to show last updatetime can use somthing like strtotime("last Monday") depending on your crontime


      ---------------------------------------------------------------------------------
      or even more easy would be
      SELECT * INTO %%STATISTICs24%% from %%STATISTICS%%;

      then there are no additional statbuilderfiles needed