-
Notifications
You must be signed in to change notification settings - Fork 0
/
automate.sh
53 lines (47 loc) · 1.38 KB
/
automate.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
session=$1
array=('a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k')
touch ./moss/plagiarismReport.csv
if [ ! -s "./moss/plagiarismReport.csv" ];
then
echo Section,Link >> ./moss/plagiarismReport.csv
fi
# Scrape all submissions from hackerrank
cd Scraper
mkdir -p Results
npm install
python3 scraper_script.py "$session"
for section in ${array[@]};
do
slug="daa-s$session-$section"
file1="./Results/$slug.csv"
if [ ! -f $file1 ];
then
python3 leaderboard.py "https://www.hackerrank.com/contests/$slug/leaderboard"
fi
echo $slug
cp $slug.csv ../Submission
# Organize submissions into a separate folder for each student
cd ../Submission
mkdir -p Submissions
python3 organizeCodes.py ./Submissions/ $slug.csv
mv ./Submissions ../moss/
# Send the pruned submissions to MOSS servers for plagiarism check
cd ../moss
mkdir -p hwX_join hwX_prune
touch temp.txt plagiarismReport.csv
python3 run_moss.py $slug
# Clear all intermediate files and folders generated and go to Scraper
rm -rf hwX_join hwX_prune Submissions
truncate -s 0 ./temp.txt
cd ../Scraper
done
echo -e "Plagiarism links will be available in ./moss/plagiarismReport.csv\n"
cd ../moss
bash ./gen_list.sh
for section in ${array[@]};
do
# Generate final list from leaderboard and deduction after plagiarism
cd ../Scraper/Results/
python3 fill_excel.py $section $session
cd ../
done