Statistic error

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

    • Statistic error

      Hello.
      I have a problem with the statistics, I do not know why not update themselves.

      I have a mistake, what he Means?
      [23-Feb-2017 11:43:38] NOTICE: "Undefined index: build"
      File: /includes/classes/class.statbuilder.php | Line: 414
      URL: https://xnova-24.pl/uni1/cronjob.php?cronjobID=4 | Version: 1.3.2306
      Stack trace:
      #0 /includes/classes/class.statbuilder.php(414): errorHandler(8, 'Undefined index...', '/includes/class...', 414, Array)
      #1 /includes/classes/cronjob/StatisticCronjob.class.php(37): statbuilder->MakeStats()
      #2 /includes/classes/Cronjob.class.php(53): StatisticCronjob->run()
      #3 /cronjob.php(36): Cronjob::execute(4)
      #4 {main}

      Here is my file

      PHP Source Code: class.statbuilder.php

      1. final public function MakeStats()
      2. {
      3. global $resource;
      4. $AllyPoints = array();
      5. $UserPoints = array();
      6. $TotalData = $this->GetUsersInfosFromDB();
      7. $FinalSQL = 'TRUNCATE TABLE '.STATPOINTS.';';
      8. $FinalSQL .= "INSERT INTO ".STATPOINTS." (id_owner, id_ally, stat_type, universe, tech_old_rank, tech_points, tech_count, build_old_rank, build_points, build_count, defs_old_rank, defs_points, defs_count, fleet_old_rank, fleet_points, fleet_count, total_old_rank, total_points, total_count, ach_old_rank, ach_points, ach_count) VALUES ";
      9. while($PlanetData = $GLOBALS['DATABASE']->fetch_array($TotalData['Planets']))
      10. {
      11. if((in_array(Config::get('stat'), array(1, 2)) && $PlanetData['authlevel'] >= Config::get('stat_level')) || !empty($PlanetData['bana'])) continue;
      12. if(!isset($UserPoints[$PlanetData['id_owner']])) {
      13. $UserPoints[$PlanetData['id_owner']]['build']['count'] = $UserPoints[$PlanetData['id_owner']]['build']['points'] = 0;
      14. }
      15. $BuildPoints = $this->GetBuildPoints($PlanetData);
      16. $UserPoints[$PlanetData['id_owner']]['build']['count'] += $BuildPoints['count'];
      17. $UserPoints[$PlanetData['id_owner']]['build']['points'] += $BuildPoints['points'];
      18. }
      19. $GLOBALS['DATABASE']->free_result($TotalData['Planets']);
      20. $UniData = array();
      21. while($UserData = $GLOBALS['DATABASE']->fetch_array($TotalData['Users']))
      22. {
      23. if(!isset($UniData[$UserData['universe']]))
      24. $UniData[$UserData['universe']] = 0;
      25. $UniData[$UserData['universe']]++;
      26. if ((in_array(Config::get('stat'), array(1, 2)) && $UserData['authlevel'] >= Config::get('stat_level')) || !empty($UserData['bana']))
      27. {
      28. $FinalSQL .= "(".$UserData['id'].",".$UserData['ally_id'].",1,".$UserData['universe'].",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), ";
      29. continue;
      30. }
      31. if(isset($TotalData['Fleets'][$UserData['id']])) {
      32. foreach($TotalData['Fleets'][$UserData['id']] as $ID => $Amount)
      33. $UserData[$resource[$ID]] += $Amount;
      34. }
      35. $TechnoPoints = $this->GetTechnoPoints($UserData);
      36. $FleetPoints = $this->GetFleetPoints($UserData);
      37. $DefensePoints = $this->GetDefensePoints($UserData);
      38. $AchPoints = $this->GetAchPoints($UserData);
      39. $UserPoints[$UserData['id']]['fleet']['count'] = $FleetPoints['count'];
      40. $UserPoints[$UserData['id']]['fleet']['points'] = $FleetPoints['points'];
      41. $UserPoints[$UserData['id']]['defense']['count'] = $DefensePoints['count'];
      42. $UserPoints[$UserData['id']]['defense']['points'] = $DefensePoints['points'];
      43. $UserPoints[$UserData['id']]['techno']['count'] = $TechnoPoints['count'];
      44. $UserPoints[$UserData['id']]['techno']['points'] = $TechnoPoints['points'];
      45. $UserPoints[$UserData['id']]['achie']['count'] = $AchPoints['count'];
      46. $UserPoints[$UserData['id']]['achie']['points'] = $AchPoints['points'];
      47. $UserPoints[$UserData['id']]['total']['count'] = $UserPoints[$UserData['id']]['techno']['count']
      48. + $UserPoints[$UserData['id']]['build']['count']
      49. + $UserPoints[$UserData['id']]['defense']['count']
      50. + $UserPoints[$UserData['id']]['fleet']['count']
      51. + $UserPoints[$UserData['id']]['achie']['count'];
      52. $UserPoints[$UserData['id']]['total']['points'] = $UserPoints[$UserData['id']]['techno']['points']
      53. + $UserPoints[$UserData['id']]['build']['points']
      54. + $UserPoints[$UserData['id']]['defense']['points']
      55. + $UserPoints[$UserData['id']]['fleet']['points']
      56. + $UserPoints[$UserData['id']]['achie']['points'];
      57. $UserPoints[$UserData['id']]['achie']['count'] = $AchPoints['count'];
      58. $UserPoints[$UserData['id']]['achie']['points'] = $AchPoints['points'];
      59. if($UserData['ally_id'] != 0)
      60. {
      61. if(!isset($AllyPoints[$UserData['ally_id']]))
      62. {
      63. $AllyPoints[$UserData['ally_id']]['build']['count'] = 0;
      64. $AllyPoints[$UserData['ally_id']]['build']['points'] = 0;
      65. $AllyPoints[$UserData['ally_id']]['fleet']['count'] = 0;
      66. $AllyPoints[$UserData['ally_id']]['fleet']['points'] = 0;
      67. $AllyPoints[$UserData['ally_id']]['defense']['count'] = 0;
      68. $AllyPoints[$UserData['ally_id']]['defense']['points'] = 0;
      69. $AllyPoints[$UserData['ally_id']]['techno']['count'] = 0;
      70. $AllyPoints[$UserData['ally_id']]['techno']['points'] = 0;
      71. $AllyPoints[$UserData['ally_id']]['total']['count'] = 0;
      72. $AllyPoints[$UserData['ally_id']]['total']['points'] = 0;
      73. $AllyPoints[$UserData['ally_id']]['achie']['count'] = 0;
      74. $AllyPoints[$UserData['ally_id']]['achie']['points'] = 0;
      75. }
      76. $AllyPoints[$UserData['ally_id']]['build']['count'] += $UserPoints[$UserData['id']]['build']['count'];
      77. $AllyPoints[$UserData['ally_id']]['build']['points'] += $UserPoints[$UserData['id']]['build']['points'];
      78. $AllyPoints[$UserData['ally_id']]['fleet']['count'] += $UserPoints[$UserData['id']]['fleet']['count'];
      79. $AllyPoints[$UserData['ally_id']]['fleet']['points'] += $UserPoints[$UserData['id']]['fleet']['points'];
      80. $AllyPoints[$UserData['ally_id']]['defense']['count'] += $UserPoints[$UserData['id']]['defense']['count'];
      81. $AllyPoints[$UserData['ally_id']]['defense']['points'] += $UserPoints[$UserData['id']]['defense']['points'];
      82. $AllyPoints[$UserData['ally_id']]['techno']['count'] += $UserPoints[$UserData['id']]['techno']['count'];
      83. $AllyPoints[$UserData['ally_id']]['techno']['points'] += $UserPoints[$UserData['id']]['techno']['points'];
      84. $AllyPoints[$UserData['ally_id']]['total']['count'] += $UserPoints[$UserData['id']]['total']['count'];
      85. $AllyPoints[$UserData['ally_id']]['total']['points'] += $UserPoints[$UserData['id']]['total']['points'];
      86. $AllyPoints[$UserData['ally_id']]['achie']['count'] += $UserPoints[$UserData['id']]['achie']['count'];
      87. $AllyPoints[$UserData['ally_id']]['achie']['points'] += $UserPoints[$UserData['id']]['achie']['points'];
      88. }
      89. $FinalSQL .= "(".
      90. $UserData['id'].", ".
      91. $UserData['ally_id'].", 1, ".
      92. $UserData['universe'].", ".
      93. (isset($UserData['old_tech_rank']) ? $UserData['old_tech_rank'] : 0).", ".
      Display All
    • You have a player with 0 planets and thus no builds to calculate and trow you the error instead

      Regards
    • You need to find the players that have no planets in uni1_planets and delete that player or give him a planet
    • I do not know why it does not update statistics.
      Cron works normally.
      I do not know where to look for the error?
      In which file? :(
    • Response 1: You have a player with 0 planets and thus no builds to calculate and trow you the error instead
      Response 2: You need to find the players that have no planets in uni1_planets and delete that player or give him a planet

      There are no errors in the file, just fix your problem for that player that have no planets, directly in your database
    • Thisishowwedoit wrote:

      Response 1: You have a player with 0 planets and thus no builds to calculate and trow you the error instead<br style="background-color: rgb(252, 253, 254);">Response 2: You need to find the players that have no planets in uni1_planets and delete that player or give him a planet<br style="background-color: rgb(252, 253, 254);"><br style="background-color: rgb(252, 253, 254);">There are no errors in the file, just fix your problem for that player that have no planets, directly in your database
      I have such an error yet.

      Could it be a cause?

      Source Code

      1. [20-Mar-2017 20:28:45] UWAGA: "Undefined offset: 47"
      2. Plik: /includes/classes/class.BuildFunctions.php | Linia: 83
      3. URL: https://xnova-24.pl/uni5/game.php | Wersja: 01.03.2306
      4. Ślad stosu:
      5. # 0 /includes/classes/class.BuildFunctions.php(83): errorHandler (8 "Undefined offse ... ',' / includes / klasa ... ', 83, Array)
      6. # 1 /includes/classes/class.PlanetRessUpdate.php(447): BuildFunctions :: getElementPrice (Array, 47, false)
      7. 2 /includes/classes/class.PlanetRessUpdate.php(379) ResourceUpdate- ° SetNextQueueElementOnTop ()
      8. 3 /includes/classes/class.PlanetRessUpdate.php(100) ResourceUpdate- ° BuildingQueue ()
      9. # 4 /includes/pages/game/class.AbstractPage.php(18): ResourceUpdate- & gt; CalcResource ()
      10. # 5 /includes/pages/game/class.ShowOverviewPage.php(35): AbstractPage- & gt; __ Konstrukt ()
      11. # 6 /game.php(51): ShowOverviewPage- & gt; __ Konstrukt ()
      12. # 7 {main}
      Display All
    • No you can select each user via sql querie and check if each player has more then 0 planets
      or you can add a free planet as bonus to all your users and this problem will be gone but anyway none of those solutions will permantly fix your problem as you need to find out why that specific player have 0 planets.
      Was he able to delete main planet ? main planet not created a register ? alot of possibilities
    • Btw try to open a thread for each error :)

      The first error happen in

      [23-Feb-2017 11:43:38] NOTICE: "Undefined index: build"
      File: /includes/classes/class.statbuilder.php | Line: 414


      The second in
      [20-Mar-2017 20:28:45] UWAGA: "Undefined offset: 47"
      Plik: /includes/classes/class.BuildFunctions.php | Linia: 83


      2 different errors


      Regards