Register | Login
Attackpoint - performance and training tools for orienteering athletes

Training Log: edwarddes

In the last 7 days:

«
0:00
0:00
SuMoTuWeThFrSa

Wednesday Sep 20 #

Note

EventReg Daily WTF:

The generated conf_num is used to join across a few tables. Why not just use the id column of the tables instead? Also note that db_id just rolled over 40000. So much fail in this code.


/**
* get_conf_num($db_id,$reg_type)
* creates a conf number based on:
* two digit year
* three digit julian date
* oregrun.id from the blank record created for this orienteer
* reg_type
* @param int $db_id, int $reg_type
* @return int conf_num
*/
public function get_conf_num($db_id,$reg_type)
{
// $filename = 'assets/conf_num/conf_num.dat';
// if (($fp = fopen($filename,"r+")) === FALSE) {
// echo 'Failed to open ' . $filename;
// } else {
// $num = trim(fgets($fp, 16));
// $conf_num =
sprintf("%d%03d%04d",date("Y")-2000,date("z"),$num);
// fseek($fp,0);
// ftruncate($fp,0);
// if ($num++ > 9999)
// $num = 1;
// fwrite($fp,$num);
// fclose($fp);
// }
// return $conf_num;
//just use the last four digits of the database ID
// if (($db_id) >= 10000 && ($db_id) < 100000):
// $db_id -= 10000;
// endif;
// if ($db_id >= 100000):
// $db_id -= 100000;
// endif;

if (($db_id) >= 10000 && ($db_id) < 20000):
$db_id -= 10000;
endif;
if (($db_id) >= 20000 && ($db_id) < 30000):
$db_id -= 20000;
endif;
if (($db_id) >= 30000 && ($db_id) < 40000):
$db_id -= 30000;
endif;
if ($db_id >= 100000):
$db_id -= 100000;
endif;


// $conf_num = sprintf("%d%03d%d%1d",date("Y")-2000,date("z"),$db_id,$reg_type);
$conf_num = sprintf("%d%03d%d%1d",date("Y")-2000,date("z"),$db_id,$reg_type);

return $conf_num;
}

« Earlier

Recent Comments

3+ days ago
mod anyone? 1  
more...

Reports

Search Log



Recent Weeks:

Week
Ending
Training hours by intensity
0123456789
10
Sep 23
Sep 9
Sep 2
Jul 1
Jun 10

Week
Ending
Training hours by activity
0123456789
10
Sep 23
Sep 9
Sep 2
Jul 1
Jun 10

Week
Ending
Training miles by activity
051015202530354045
50
Sep 23
Sep 9
Sep 2
Jul 1
Jun 10

all weeks | months | years | as calendar