Changeset 884
- Timestamp:
- 01/23/08 17:37:32 (4 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 1 deleted
- 6 edited
-
common/rating.php (modified) (1 diff)
-
junk/attach-fix-case (deleted)
-
scripts/attach-fix-case (added)
-
scripts/check-attachments (modified) (1 diff)
-
scripts/send-newsletter (modified) (1 diff)
-
www/static/css/screen.css (modified) (1 diff)
-
www/views/plot_distribution.php (modified) (5 diffs)
-
www/views/plot_rating.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/common/rating.php
r852 r884 42 42 define("IA_RATING_TWEAK_PERIOD", 3); 43 43 define("IA_MIN_SCALED_RATING", 0); 44 define("IA_MAX_SCALED_RATING", 1 000);44 define("IA_MAX_SCALED_RATING", 1500); 45 45 46 46 // number square -
trunk/scripts/check-attachments
r852 r884 10 10 11 11 $res = db_query("SELECT `id`, `name`, `page` FROM ia_file"); 12 13 if (read_bool("Lower case all attachments files?", true)) {14 $extra_files = glob(IA_ROOT_DIR . "attach/*");15 foreach ($extra_files as $fname) {16 if (preg_match('/[A-Z]/', $fname)) {17 rename($fname, strtolower($fname));18 }19 }20 unset($extra_files);21 }22 12 23 13 $extra_files = array_flip(glob(IA_ROOT_DIR . "attach/*")); -
trunk/scripts/send-newsletter
r860 r884 55 55 case 'test': 56 56 // a small set of users. meant for testing 57 $usernames = array('wickedman', 'fluffy', 'domino', 'silviug'); 57 $usernames = array('wickedman', 'fluffy', 'domino', 'silviug', 58 'Cosmin'); 58 59 $query = "SELECT * FROM ia_user 59 60 WHERE username IN ('".join("', '", $usernames)."') -
trunk/www/static/css/screen.css
r881 r884 995 995 padding: 5px; 996 996 margin: 0; 997 -moz-border-radius: 10px; 997 998 } 998 999 -
trunk/www/views/plot_distribution.php
r852 r884 15 15 // gnuplot script 16 16 $script = " 17 set terminal postscript noenhanced 17 18 set grid 18 19 19 20 set rmargin 2 20 21 set lmargin 5 21 set tmargin 1 222 set tmargin 15 22 23 set bmargin 2 23 24 set xtics nomirror … … 27 28 28 29 set style line 1 lt 1 lw 4 pt 3 ps 0.5 29 set style line 2 lt 7 lw 6 pt 7 ps 1.0 30 set style line 3 lt 11 lw 3 31 set xrange [350:960] 30 set style line 2 lt 3 lw 6 pt 7 ps 1.0 31 set style line 3 lt 11 lw 6 32 set xrange [350:1130] 33 set yrange [0:250] 32 34 33 set xtics 5034 set xtic rotate by - 3535 set xtics 100 36 set xtic rotate by -20 35 37 36 38 "; … … 38 40 // legend 39 41 $script .= " 40 set key left top box 342 set key right top box 3 41 43 set key width -1.5 42 44 "; … … 47 49 set parametric 48 50 const={$user_rating} 49 set trange [0: 100]51 set trange [0:250] 50 52 "; 51 53 } … … 54 56 $script .= " 55 57 plot \\ 56 \"%data%\" using 1:2 title \"Concurenti\" with histeps ls 3, \\57 \"%data%\" using 1:2 smooth beziertitle \"Aproximare\" with lines ls 1";58 \"%data%\" using 1:2 title \"Concurenti\" with impulses ls 3, \\ 59 \"%data%\" using 1:2 smooth csplines title \"Aproximare\" with lines ls 1"; 58 60 59 61 // plot user -
trunk/www/views/plot_rating.php
r852 r884 6 6 if (2 <= count($history)) { 7 7 $keys = array_keys($history); 8 $range_start = $history[$keys[0]]['timestamp'] - 30*24*3600; 9 $range_end = $history[$keys[count($history)-1]]['timestamp'] + 30*24*3600; 8 $range_start = $history[$keys[0]]['timestamp']; 9 $range_end = $history[$keys[count($history)-1]]['timestamp']; 10 $rating_start = $history[$keys[0]]['rating']; 11 $rating_end = $rating_start; 12 foreach ($history as $round_id => $round) { 13 $rating_start = min($rating_start, $round['rating']); 14 $rating_end = max($rating_end, $round['rating']); 15 } 16 $rating_start = rating_scale($rating_start)-50; 17 $rating_end = rating_scale($rating_end)+50; 10 18 } 11 19 else { … … 13 21 $range_start = mktime(1, 0, 0, 1, 1, 2004); 14 22 $range_end = time(); 23 $rating_start = 0; $rating_end = 1000; 15 24 } 16 25 // compute months between date range to show as xtics 17 list($dy, $dm, $dd) = split('-', date('Y-m-d', $range_ start));26 list($dy, $dm, $dd) = split('-', date('Y-m-d', $range_end)); 18 27 $i = 0; 19 28 $xtics = array(); 29 $scale = ceil(($range_end-$range_start)/(30*24*3600)/12); 20 30 while (true) { 21 $dx = mktime(1, 0, 0, $dm +$i, $dd, $dy);31 $dx = mktime(1, 0, 0, $dm - $i, $dd, $dy); 22 32 $xtics[] = date('Y-m-d', $dx); 23 if ($dx > $range_end) {33 if ($dx < $range_start) { 24 34 break; 25 35 } 26 $i += 2;36 $i += $scale; 27 37 } 38 $xtics = array_reverse($xtics); 28 39 29 40 // format date ranges for gnuplot 30 $range_start = date('Y-m-d', $range_start );31 $range_end = date('Y-m-d', $range_end );41 $range_start = date('Y-m-d', $range_start - 15*24*3600); 42 $range_end = date('Y-m-d', $range_end + 15*24*3600); 32 43 33 44 // gnuplot script 34 45 $script = " 46 set terminal postscript noenhanced 47 set locale \"ro_RO.UTF-8\" 35 48 set xdata time 36 49 set timefmt \"%Y-%m-%d\" 37 50 set format x \"%b %y\" 38 39 40 51 set grid 41 52 42 set rmargin 253 set rmargin 5 43 54 set lmargin 5 44 55 set tmargin 12 … … 50 61 51 62 set style line 1 lt 1 lw 4 pt 3 ps 0.5 52 set style line 2 lt 3 lw 4 pt 7 ps 1.63 set style line 2 lt 3 lw 3 pt 7 ps 1.0 53 64 set style line 3 lt 11 lw 3 54 65 set xrange [\"{$range_start}\":\"{$range_end}\"] 66 set yrange [{$rating_start}:{$rating_end}] 55 67 56 68 set xtics ('".join("', '", $xtics)."') 57 69 set xtic rotate by -20 58 59 70 60 71 set clip … … 63 74 // display round_id labels 64 75 $i = 1; 76 $scale = ceil(($rating_end-$rating_start)/20); 65 77 foreach ($history as $round_id => $round) { 66 78 $date = date("Y-m-d", $round['timestamp']); 67 $rating = rating_scale($round['rating']) + ($i % 2 ? 100 : -100);79 $rating = rating_scale($round['rating']) + ($i % 2 ? $scale : -$scale); 68 80 $align = ($i % 2 ? "left" : "right"); 69 81 $align = "left"; 70 $script .= "set label {$i} \"{$i}\" at \"{$date}\",{$rating} {$align} font \"Helvetica,1 7\" back tc lt 9\n";82 $script .= "set label {$i} \"{$i}\" at \"{$date}\",{$rating} {$align} font \"Helvetica,19\" back tc lt 9\n"; 71 83 $i++; 72 84 } … … 83 95 plot \\ 84 96 \"%data%\" using 1:2 title \"Rating\" with lines ls 1, \\ 85 \"%data%\" using 1:2 smooth bezier title \"Medie\" with lines ls 3, \\ 86 \"%data%\" using 1:2:3 title \"Deviatie\" with errorbars ls 2 97 \"%data%\" using 1:2 notitle with points ls 2 87 98 "; 88 99 }
Note: See TracChangeset
for help on using the changeset viewer.
![[infoarena] development](/chrome/site/logo.png)