Show level table
This commit is contained in:
parent
0d4770e290
commit
d9e801110d
144
graph
144
graph
@ -154,31 +154,131 @@ then
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
||||||
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<head>
|
<head>
|
||||||
<title>IngRRD - Graph</title>
|
<title>IngRRD - Graph</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<table style="width:$(( graph_width + 97 ))px">
|
EOHTML
|
||||||
|
|
||||||
|
readarray -t lastupdatelines < <(
|
||||||
|
rrdtool lastupdate $rrdfile
|
||||||
|
)
|
||||||
|
indices=( ${lastupdatelines[0]} )
|
||||||
|
values=( ${lastupdatelines[2]#*:} )
|
||||||
|
declare -A last
|
||||||
|
for index in ${!indices[@]}
|
||||||
|
do
|
||||||
|
last["${indices[index]}"]=${values[index]}
|
||||||
|
done
|
||||||
|
unset indices values
|
||||||
|
|
||||||
|
for stat in "${medals[@]}"
|
||||||
|
do
|
||||||
|
if (( last["$stat"] >= bronze["$stat"] ))
|
||||||
|
then
|
||||||
|
(( bronzecount++ ))
|
||||||
|
if (( last["$stat"] >= silver["$stat"] ))
|
||||||
|
then
|
||||||
|
(( silvercount++ ))
|
||||||
|
if (( last["$stat"] >= gold["$stat"] ))
|
||||||
|
then
|
||||||
|
(( goldcount++ ))
|
||||||
|
if (( last["$stat"] >= platinum["$stat"] ))
|
||||||
|
then
|
||||||
|
(( platinumcount++ ))
|
||||||
|
if (( last["$stat"] >= black["$stat"] ))
|
||||||
|
then
|
||||||
|
(( blackcount++ ))
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
cat <<-EOHTML
|
||||||
|
<div>
|
||||||
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>Level</td>
|
||||||
<a href="?start=$(( start - 604800 ))&end=$end"><<</a>
|
<td>AP</td>
|
||||||
<a href="?start=$(( start - 86400 ))&end=$end"><</a>
|
<td>Silver</td>
|
||||||
<a href="?start=$default_start&end=$end">R</a>
|
<td>Gold</td>
|
||||||
<a href="?start=$(( start + 86400 ))&end=$end">></a>
|
<td>Platinum</td>
|
||||||
<a href="?start=$(( start + 604800 ))&end=$end">>></a>
|
<td>Black</td>
|
||||||
</td>
|
|
||||||
<td align="center">
|
|
||||||
<a href="add.html">Add data</a>
|
|
||||||
</td>
|
|
||||||
<td align="right">
|
|
||||||
<a href="?start=$start&end=$(( end - 604800 ))"><<</a>
|
|
||||||
<a href="?start=$start&end=$(( end - 86400 ))"><</a>
|
|
||||||
<a href="?start=$start&end=$default_end">R</a>
|
|
||||||
<a href="?start=$start&end=$(( end + 86400 ))">></a>
|
|
||||||
<a href="?start=$start&end=$(( end + 604800 ))">>></a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td> </td>
|
||||||
|
<td>${last["AP"]}</td>
|
||||||
|
<td>$silvercount</td>
|
||||||
|
<td>$goldcount</td>
|
||||||
|
<td>$platinumcount</td>
|
||||||
|
<td>$blackcount</td>
|
||||||
|
</tr>
|
||||||
|
EOHTML
|
||||||
|
for level in {1..16}
|
||||||
|
do
|
||||||
|
echo "<tr><td>$level</td>"
|
||||||
|
if (( last["AP"] >= lvl[level] ))
|
||||||
|
then
|
||||||
|
echo '<td style="background:lightgreen">'
|
||||||
|
printf "%'li" ${lvl[level]}
|
||||||
|
echo '</td>'
|
||||||
|
else
|
||||||
|
echo '<td style="background:grey">'
|
||||||
|
printf "%'li" $(( last["AP"] - lvl[level] ))
|
||||||
|
echo '</td>'
|
||||||
|
fi
|
||||||
|
if (( silvercount >= lvlsilver[level] ))
|
||||||
|
then
|
||||||
|
echo '<td style="background:lightgreen">'${lvlsilver[level]}'</td>'
|
||||||
|
else
|
||||||
|
echo '<td style="background:grey">'$(( silvercount - lvlsilver[level] ))'</td>'
|
||||||
|
fi
|
||||||
|
if (( goldcount >= lvlgold[level] ))
|
||||||
|
then
|
||||||
|
echo '<td style="background:lightgreen">'${lvlgold[level]}'</td>'
|
||||||
|
else
|
||||||
|
echo '<td style="background:grey">'$(( goldcount - lvlgold[level] ))'</td>'
|
||||||
|
fi
|
||||||
|
if (( platinumcount >= lvlplatinum[level] ))
|
||||||
|
then
|
||||||
|
echo '<td style="background:lightgreen">'${lvlplatinum[level]}'</td>'
|
||||||
|
else
|
||||||
|
echo '<td style="background:grey">'$(( platinumcount - lvlplatinum[level] ))'</td>'
|
||||||
|
fi
|
||||||
|
if (( blackcount >= lvlblack[level] ))
|
||||||
|
then
|
||||||
|
echo '<td style="background:lightgreen">'${lvlblack[level]}'</td>'
|
||||||
|
else
|
||||||
|
echo '<td style="background:grey">'$(( blackcount - lvlblack[level] ))'</td>'
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "</tr>"
|
||||||
|
done
|
||||||
|
cat <<-EOHTML
|
||||||
</table>
|
</table>
|
||||||
|
</div>
|
||||||
|
<table style="width:$(( graph_width + 97 ))px">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<a href="?start=$(( start - 604800 ))&end=$end"><<</a>
|
||||||
|
<a href="?start=$(( start - 86400 ))&end=$end"><</a>
|
||||||
|
<a href="?start=$default_start&end=$end">R</a>
|
||||||
|
<a href="?start=$(( start + 86400 ))&end=$end">></a>
|
||||||
|
<a href="?start=$(( start + 604800 ))&end=$end">>></a>
|
||||||
|
</td>
|
||||||
|
<td align="center">
|
||||||
|
<a href="add.html">Add data</a>
|
||||||
|
</td>
|
||||||
|
<td align="right">
|
||||||
|
<a href="?start=$start&end=$(( end - 604800 ))"><<</a>
|
||||||
|
<a href="?start=$start&end=$(( end - 86400 ))"><</a>
|
||||||
|
<a href="?start=$start&end=$default_end">R</a>
|
||||||
|
<a href="?start=$start&end=$(( end + 86400 ))">></a>
|
||||||
|
<a href="?start=$start&end=$(( end + 604800 ))">>></a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
EOHTML
|
EOHTML
|
||||||
|
|
||||||
if (( show_all ))
|
if (( show_all ))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user