laradb

script pour établir une bdd Ãà partir d'un tsv avec différent format - retour accueil

git clone git://bebou.netlib.re/laradb
Log | Files | Refs |

commit cd1e8d6d14dce667b11c09e22161f618f03c40bc
parent 5335bdd328d94344dcb391589b7b7122cacf3709
Auteurice: vi <vi@bb.re>
Date:   Sun,  3 Nov 2024 13:09:42 +0100

frise avec les dates exacte juste pour l'instant y'a un pb d'architecture du code

Diffstat:
Msrc/frise.sh | 63+++++++++++++++++++++++++++++++++++++--------------------------
1 file changed, 37 insertions(+), 26 deletions(-)

diff --git a/src/frise.sh b/src/frise.sh @@ -5,36 +5,37 @@ -entree(){ - echo "$line" | cut -d" " -f $1 | tee $1 - #echo "$line" | tsv-select -f $1 -} -date_normalisation () { -# nouveau script dans src/utils/ -} +DIST="../dist" +DB="db.tsv" +epoch_start="../tmp/start_unixepoch" +epoch_end="../tmp/end_unixepoch" -values(){ -} +max=$( sort ../tmp/end | tail -n1 | grep -o "^.\{4\}" | sed 's/$/ + 1/' | bc ) +min=$( sort ../tmp/start | head -n1 | grep -o "^.\{4\}") +echo "max = $max : min = $min" +# max = 2012 : min = 1971 -max=$(bc -e "2012-1955" -e quit) -min=$() +min_epoch=$( cut -f1 ../tmp/dateEpoch_final.tsv | sort -g | head -n1) +max_epoch=$( cut -f2 ../tmp/dateEpoch_final.tsv | sort -g | tail -n1) +echo "$min_epoch ; $max_epoch " +# 41900400 ; 1304200800 +entree(){ + echo "$line" | cut -d" " -f $1 | tee $1 + #echo "$line" | tsv-select -f $1 +} left(){ - bc -l -e "( $(cat 4) - 1955)/ $max * 100" -e quit + bc -l -e "( $(entree 1) - $min_epoch)/ $max_epoch * 100" -e quit } width(){ - bc -l -e "( $(cat 5) - $(cat 4) )/ $max * 100" -e quit + bc -l -e "( $(entree 2) - $(entree 1) )/ $max_epoch * 100" -e quit } - annee(){ - seq 1955 2012 | xargs printf '<td onclick="sortTable(2)" class="annee">%s</td>\n' + seq $min $max | xargs printf '<td onclick="sortTable(2)" class="annee">%s</td>\n' } -DIST="../dist" -DB="ex_db.tsv" - LIGNE=1 cat << % > $DIST/frise.html <!DOCTYPE html> @@ -75,14 +76,8 @@ ENTETE else cat <<- CORPS <tr> - <td class="titre-complet"> $(entree "2"; entree "3"; entree "4"; entree "5" ; entree "6" )</td> - <td data-length="$(width)" class="rectangle"> - <div> - <div style="left: $(left)% ; width: $(width)%; background-color: red; height: 1rem; position: absolute ;"> - </div> - </div> - </td> - </tr> + <td class="titre-complet"> $(entree "1"; entree "4"; entree "5" ; entree "6" )</td> + </tr> CORPS @@ -90,6 +85,22 @@ CORPS LIGNE=$(($LIGNE + 1)) done < $DB ) + +$(LIGNE=1; while IFS= read -r line; do + cat <<- GRAPH + <tr> + <td class="rectangle"> + <div> + <div style="left: $(left)% ; width: $(width)%; background-color: grey; height: 1rem; position: relative;"> + </div> + </div> + </td> + </tr> +GRAPH + + LIGNE=$(($LIGNE + 1)) +done < ../tmp/dateEpoch_final.tsv +) </table> </body>