#!/bin/bash
set -ex

DATABASE="logging"
EVAL_DIR=$1
LOG_TRANS_FILE=log_transformation_actions.csv
LOG_TRANS_PATH="$1/$LOG_TRANS_FILE"
RESULTS_TABLE=tool_results
RESULTS_FILE=result.csv
RESULTS_PATH="$1"/"$RESULTS_FILE"
REPOS_TABLE=tool_repos
REPOS_FILE=repos.csv
REPOS_PATH="$1"/"$REPOS_FILE"

cp $RESULTS_PATH "./$RESULTS_TABLE".csv
sed -i 's/true/1/g' "./$RESULTS_TABLE".csv
sed -i 's/false/0/g' "./$RESULTS_TABLE".csv
./myimport.sh "$DATABASE" "$RESULTS_TABLE"
rm "./$RESULTS_TABLE".csv

cp $REPOS_PATH "./$REPOS_TABLE".csv
sed -i 's/true/1/g' "./$REPOS_TABLE".csv
sed -i 's/false/0/g' "./$REPOS_TABLE".csv
./myimport.sh "$DATABASE" "$REPOS_TABLE"
rm "./$REPOS_TABLE".csv

# Import to DB.
python3 logImportScript.py "$LOG_TRANS_PATH"
