Seite 24 von 108

Verfasst: 23.05.2008 11:54
von buegelfalte
Patch hat geschrieben:Resultat:
Torjäger Tipp ??

Verfasst: 23.05.2008 12:42
von Patch
ich muss mich korriegiern. Das stimmt so leider immer noch nicht. in der Funktion get_em_user_points_up_to_yesterday wird mit einer sql abfrage die Ranglsite des vorherigen Spieles ermittelt. Bloß dabei wird statt den Anstoßzeiten der Spiele die Tippzeit des users herangezogen?! Völliger Unsinn...
Gab es mit den Tendenzen während des wm Tippspiels eigentlich auch solche Probleme? ich kann mich gar nicht mehr erinnern

@buegelfalte
ja,hab ich bei mir zusätzlich eingebaut. jedoch muss ich gleich anmerken, das ich mich bei der Programmierung an keine phpbb Grundsätze gehalten habe. sprich ich verwende keine $lang variablen und hab auch keine Konstanten für die Tabellennamen verwendet. Außerdem verwende ich in den mySQL Abgragen Unterabfragen. Das können nicht alle mySQL Versionen. Deshalb spar ich mir den Release als Addon :-)

Verfasst: 23.05.2008 12:48
von buegelfalte
Patch hat geschrieben:Deshalb spar ich mir den Release als Addon :-)
Kenn ich - (nur) bei mir gibts den "Regenbogentipper", bei dem hohe korrekte Tipps extra belohnt werden ... ;)

Verfasst: 23.05.2008 12:57
von Patch
um jetzt alle zu wirklich alle zu verwirren :D nochmal ein Lösungsansatz für die Tendenzpfeile. Bir mir stimmt es damit. Aber vorsicht, es wird mySQL 4.1 oder höher vorausgesetzt
öffne functions_em.php
finde:

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
   }

 }


ersetze mit:

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
   }

 }

finde:

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";
ersetzte mit

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";
Achtung: Setzt mds. MySQL 4.1 oder höher voraus

finde:

Code: Alles auswählen

, user_points_tendency DESC
füge dahinter an

Code: Alles auswählen

, tipp_user ASC

öffne em_stats.php (muss wieder auf Urprung zurückgestzt werden)
finde:

Code: 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" />';
   }
ersetzte mit

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 habe die ersten beiden Spiele Testweise eingetragen:
23.05.2008, 00:00 Schweiz - Tschechien 1 : 2
23.05.2008, 08:00 Portugal - Türkei 3 : 1


damit jetzt folgendes Resultat: (Vergleich zu meinem Posting 994088 )
[ externes Bild ]

:grin:

Verfasst: 23.05.2008 12:58
von smithi
Patch hat geschrieben:ich muss mich korriegiern. Das stimmt so leider immer noch nicht.
ich wollts auch gerade sagen.. irgendwie scheint das net zu funktionieren.. :D

leider bin ich erst seit diesem jahr dazugestoßen.. hab vorher nicht mal gewußt das es phpbb gibt..

von daher bin ich immer wieder erstaunt was alles möglich ist.. torjäger tipps .. regenbogentipper.. ich beneide euch..

Verfasst: 23.05.2008 12:59
von Patch
@buegelfalte
"Regenbogentipper", klngt ja auch interessant :D
in welcher form werden diese user belohnt?

Verfasst: 23.05.2008 13:22
von smithi
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.. :D

Verfasst: 23.05.2008 13:56
von Patch
smithi 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.. :D
da wird wohl irgendwas nicht ganz glatt gelaufen sein. Mach mal eine sicherung deiner em_stats.php
und versuch mal meine (probeweise)

Verfasst: 23.05.2008 14:54
von smithi
so erstmal die ganzen scorer_tips rausgelöscht aber immernoch das gleiche.. nur rote pfeile und punkte..

Verfasst: 23.05.2008 15:17
von Patch
smithi hat geschrieben:so erstmal die ganzen scorer_tips rausgelöscht aber immernoch das gleiche.. nur rote pfeile und punkte..
stimmt das datum der Spiele und das aktuelle Datum?
Die spiele sollten in der vergangenheit liegen