Verfasst: 23.05.2008 11:54
				
				Torjäger Tipp ??Patch hat geschrieben:Resultat:
phpBB.de - Die deutsche phpBB-Community
https://www.phpbb.de/community/
Torjäger Tipp ??Patch hat geschrieben:Resultat:
Kenn ich - (nur) bei mir gibts den "Regenbogentipper", bei dem hohe korrekte Tipps extra belohnt werden ...Patch hat geschrieben:Deshalb spar ich mir den Release als Addon
Code: Alles auswählen
 function get_timestamp_for_ranking_history(){
    global $db;
   $timestamp_now=time();
   $month = strftime("%m",$timestamp_now);
   $day = strftime("%d",$timestamp_now);
   $year = strftime("%Y",$timestamp_now);
   $timestamp_today_begin = mktime(0,0,0,$month,$day,$year);
   $timestamp_today_end = mktime(23,59,0,$month,$day,$year);
   $timestamp_first_game_of_today;
   $timestamp_first_game_of_last_day_with_a_game;
   $timestamp_last_game_of_last_day_with_a_game;
   // get playing times of today
   $sql = "SELECT  game_time
      FROM  " . EM_FINALS_TABLE . "
      WHERE game_time > ". $timestamp_today_begin ."
         AND game_time < ". $timestamp_today_end ."
        ORDER BY game_time ASC";
   if( !($result_times = $db->sql_query($sql)) )
   {
      message_die(GENERAL_ERROR, 'Could not get playing times of today', '', __LINE__, __FILE__, $sql);
   }
   $row_times = $db->sql_fetchrow($result_times);
   $timestamp_first_game_of_today = $row_times['game_time'];
   if($timestamp_first_game_of_today < $timestamp_now){
      // first game of today has started -> use all results before this game
      return $timestamp_first_game_of_today;
   }else{
      // first game of today is not started
      // saerch the first game of last playing day
      $sql = "SELECT game_time
         FROM  " . EM_FINALS_TABLE . "
         WHERE game_time < ". $timestamp_today_begin ."
         ORDER BY game_time DESC";
      if( !($result_times = $db->sql_query($sql)) )
      {
         message_die(GENERAL_ERROR, 'Could not get playing times of today', '', __LINE__, __FILE__, $sql);
      }
      $row_times = $db->sql_fetchrow($result_times);
      $timestamp_last_game_of_last_day_with_a_game = $row_times['game_time'];
      $month_last_day_with_a_game = strftime("%m",$timestamp_last_game_of_last_day_with_a_game);
      $day_last_day_with_a_game = strftime("%d",$timestamp_last_game_of_last_day_with_a_game);
      $year_last_day_with_a_game = strftime("%Y",$timestamp_last_game_of_last_day_with_a_game);
      $timestamp_last_day_with_a_game_begin =
      mktime(0,0,0,$month_last_day_with_a_game,$day_last_day_with_a_game,$year_last_day_with_a_game);
      $timestamp_last_day_with_a_game_end =
      mktime(23,59,0,$month_last_day_with_a_game,$day_last_day_with_a_game,$year_last_day_with_a_game);
      $sql = "SELECT game_time
         FROM  " . EM_FINALS_TABLE . "
         WHERE game_time > ". $timestamp_last_day_with_a_game_begin ."
            AND game_time < ". $timestamp_last_day_with_a_game_end ."
         ORDER BY game_time ASC";
      if( !($result_times = $db->sql_query($sql)) )
      {
         message_die(GENERAL_ERROR, 'Could not get playing times of today', '', __LINE__, __FILE__, $sql);
      }
      $row_times = $db->sql_fetchrow($result_times);
      $timestamp_first_game_of_last_day_with_a_game = $row_times['game_time'];
      return $timestamp_first_game_of_last_day_with_a_game+1; // +1 becaouse of the < comparison
   }
 }Code: Alles auswählen
 function get_timestamp_for_ranking_history(){
    global $db;
   $timestamp_now=time();
   $month = strftime("%m",$timestamp_now);
   $day = strftime("%d",$timestamp_now);
   $year = strftime("%Y",$timestamp_now);
   $timestamp_today_begin = mktime(0,0,0,$month,$day,$year);
   $timestamp_today_end = mktime(23,59,0,$month,$day,$year);
   $timestamp_first_game_of_today;
   $timestamp_first_game_of_last_day_with_a_game;
   $timestamp_last_game_of_last_day_with_a_game;
   // get playing times of today
   $sql = "SELECT  game_time
      FROM  " . EM_FINALS_TABLE . "
      WHERE game_time > ". $timestamp_today_begin ."
         AND game_time < ". $timestamp_today_end ."
         union
      SELECT game_time
        FROM  " . EM_GAMES_TABLE . "
         WHERE game_time > ". $timestamp_today_begin ."
         AND game_time < ". $timestamp_today_end ."
        ORDER BY game_time ASC";
   if( !($result_times = $db->sql_query($sql)) )
   {
      message_die(GENERAL_ERROR, 'Could not get playing times of today', '', __LINE__, __FILE__, $sql);
   }
   $row_times = $db->sql_fetchrow($result_times);
   $timestamp_first_game_of_today = $row_times['game_time'];
   if($timestamp_first_game_of_today < $timestamp_now){
      // first game of today has started -> use all results before this game
      return $timestamp_first_game_of_today;
   }else{
      // first game of today is not started
      // saerch the first game of last playing day
      $sql = "SELECT game_time
         FROM  " . EM_FINALS_TABLE . "
         WHERE game_time < ". $timestamp_today_begin ."
              union
      SELECT game_time
        FROM  " . EM_GAMES_TABLE . "
         WHERE game_time < ". $timestamp_today_begin ."
         ORDER BY game_time DESC";
      if( !($result_times = $db->sql_query($sql)) )
      {
         message_die(GENERAL_ERROR, 'Could not get playing times of today', '', __LINE__, __FILE__, $sql);
      }
      $row_times = $db->sql_fetchrow($result_times);
      $timestamp_last_game_of_last_day_with_a_game = $row_times['game_time'];
      $month_last_day_with_a_game = strftime("%m",$timestamp_last_game_of_last_day_with_a_game);
      $day_last_day_with_a_game = strftime("%d",$timestamp_last_game_of_last_day_with_a_game);
      $year_last_day_with_a_game = strftime("%Y",$timestamp_last_game_of_last_day_with_a_game);
      $timestamp_last_day_with_a_game_begin =
      mktime(0,0,0,$month_last_day_with_a_game,$day_last_day_with_a_game,$year_last_day_with_a_game);
      $timestamp_last_day_with_a_game_end =
      mktime(23,59,0,$month_last_day_with_a_game,$day_last_day_with_a_game,$year_last_day_with_a_game);
      $sql = "SELECT game_time
         FROM  " . EM_FINALS_TABLE . "
         WHERE game_time > ". $timestamp_last_day_with_a_game_begin ."
            AND game_time < ". $timestamp_last_day_with_a_game_end ."
        union
      SELECT game_time
        FROM  " . EM_GAMES_TABLE . "
         WHERE game_time > ". $timestamp_last_day_with_a_game_begin ."
            AND game_time < ". $timestamp_last_day_with_a_game_end ."
         ORDER BY game_time ASC";
      if( !($result_times = $db->sql_query($sql)) )
      {
         message_die(GENERAL_ERROR, 'Could not get playing times of today', '', __LINE__, __FILE__, $sql);
      }
      $row_times = $db->sql_fetchrow($result_times);
      $timestamp_first_game_of_last_day_with_a_game = $row_times['game_time'];
      return $timestamp_first_game_of_last_day_with_a_game+1; // +1 becaouse of the < comparison
   }
 }Code: Alles auswählen
   $sql = "SELECT A.tipp_user , sum( A.tipp_points ) AS user_points, count( A.tipp_points ) AS user_total_tipps, count(
B.tipp_points ) AS user_points_tendency, count( C.tipp_points ) AS user_points_difference, count( D.tipp_points ) AS user_points_result
       FROM  " . EM_TIPPS_TABLE . " A
       LEFT JOIN " . EM_TIPPS_TABLE . " B ON A.tipp_id = B.tipp_id
       AND A.tipp_points = " . $em_config['points_tendency'] . "
       LEFT JOIN " . EM_TIPPS_TABLE . " C ON A.tipp_id = C.tipp_id
       AND A.tipp_points = " . $em_config['points_tordiff'] . "
       LEFT JOIN " . EM_TIPPS_TABLE . " D ON A.tipp_id = D.tipp_id
       AND A.tipp_points = " . $em_config['points_match'] . "
       WHERE A.tipp_time < ". intval($timestamp_last_game_before_this_day) ."
       GROUP BY A.tipp_user
       ORDER BY user_points DESC, user_points_result DESC, user_points_difference DESC, user_points_tendency DESC";Code: Alles auswählen
   $sql = "SELECT A.tipp_user , sum( A.tipp_points ) AS user_points, count( A.tipp_points ) AS user_total_tipps, count(
       B.tipp_points ) AS user_points_tendency, count( C.tipp_points ) AS user_points_difference, count( D.tipp_points ) AS user_points_result
       FROM  " . EM_TIPPS_TABLE . " A
       LEFT JOIN " . EM_TIPPS_TABLE . " B ON A.tipp_id = B.tipp_id
       AND A.tipp_points = " . $em_config['points_tendency'] . "
       LEFT JOIN " . EM_TIPPS_TABLE . " C ON A.tipp_id = C.tipp_id
       AND A.tipp_points = " . $em_config['points_tordiff'] . "
       LEFT JOIN " . EM_TIPPS_TABLE . " D ON A.tipp_id = D.tipp_id
       AND A.tipp_points = " . $em_config['points_match'] . "
       inner join (Select game_id, Game_time FROM " . EM_GAMES_TABLE . " Union Select game_id, Game_time FROM " . EM_FINALS_TABLE . ") as E on E.game_id = A.tipp_game and   E.game_time  < ". intval($timestamp_last_game_before_this_day) ."
       GROUP BY A.tipp_user
       ORDER BY user_points DESC, user_points_result DESC, user_points_difference DESC, user_points_tendency DESC, tipp_user ASC";
Code: Alles auswählen
, user_points_tendency DESCCode: Alles auswählen
, tipp_user ASCCode: Alles auswählen
for ( $i = 0; $i < count($em_users_data); $i++ )
{
   // user position yesterday
   $int_userpos_yesterday = get_rank_of_yesterday($em_users_data[$i]['tipp_user']);
   $int_userposalt = $int_userpos;
   $int_userpos = ($int_userpkt != $em_users_data[$i]['user_points']) ? $int_userpos + 1 : $int_userpos;
   // compare the absolute positions
   if($int_userpos_yesterday < $int_userpos )
   {
      $userpos_change = '<img src="./images/em/down.gif" alt="Down" border="0" />';
   }
   else if ($int_userpos_yesterday == $int_userpos )
   {
      $userpos_change = '<img src="./images/em/stay.gif" alt="Stay" border="0" />';
   }
   else if ($int_userpos_yesterday > $int_userpos )
   {
      $userpos_change = '<img src="./images/em/up.gif" alt="Up" border="0" />';
   }Code: Alles auswählen
for ( $i = 0; $i < count($em_users_data); $i++ )
{
   // absolute position now
   $int_userpos_absolute = $i+1;
   // user position yesterday
   $int_userpos_yesterday = get_rank_of_yesterday($em_users_data[$i]['tipp_user']);
   // compare the absolute positions
   if($int_userpos_yesterday < $int_userpos_absolute )
   {
      $userpos_change = '<img src="./images/em/down.gif" alt="Down" border="0" />';
   }
   else if ($int_userpos_yesterday == $int_userpos_absolute )
   {
      $userpos_change = '<img src="./images/em/stay.gif" alt="Stay" border="0" />';
   }
   else if ($int_userpos_yesterday > $int_userpos_absolute )
   {
      $userpos_change = '<img src="./images/em/up.gif" alt="Up" border="0" />';
   }
   $int_userposalt = $int_userpos;
   $int_userpos = ($int_userpkt != $em_users_data[$i]['user_points']) ? $int_userpos + 1 : $int_userpos;ich wollts auch gerade sagen.. irgendwie scheint das net zu funktionieren..Patch hat geschrieben:ich muss mich korriegiern. Das stimmt so leider immer noch nicht.
da wird wohl irgendwas nicht ganz glatt gelaufen sein. Mach mal eine sicherung deiner em_stats.phpsmithi hat geschrieben:so,
also die Änderungen zwecks Tendenz funktionieren bei mir leider nicht.![]()
Hab immernoch nur rote Pfeile zu allem übel rechnet er in der Rangliste nur noch mit geraden Platzierungen. Also Rang 2, 4, 6 etc. ich glaub nun hab ich alles verwurschtelt..
stimmt das datum der Spiele und das aktuelle Datum?smithi hat geschrieben:so erstmal die ganzen scorer_tips rausgelöscht aber immernoch das gleiche.. nur rote pfeile und punkte..