Skip to content

Commit

Permalink
add run download
Browse files Browse the repository at this point in the history
  • Loading branch information
Khetag Dzestelov committed Aug 16, 2024
1 parent 6bd68ca commit afbeba4
Showing 1 changed file with 30 additions and 9 deletions.
39 changes: 30 additions & 9 deletions scripts/review.sh
Original file line number Diff line number Diff line change
@@ -1,37 +1,54 @@
#!/bin/bash

templateContestId=46500

export LC_ALL=en_US.UTF-8
export PATH="$(dirname $0)/../bin:$PATH"

NC='\033[0m' # Text Reset

# Regular Colors
Red='\033[0;31m' # Red
Green='\033[0;32m' # Green
IYellow='\033[0;93m'
Cyan='\033[0;36m' # Cyan

if [ "$#" -lt 3 ]; then
echo "Usage: $0 <contestId> <filter> <count> [<showAll>]"
if [ "$#" -lt 2 ]; then
echo "Usage: $0 <contestId> <filter> [<count>] [<showAll>]"
echo
echo " Run review for pending review filtered runs in contest."
echo
echo "Arguments:"
echo
echo " contestId (int) Contest id"
echo " filter (string) Filter expression to filter runs"
echo " count (int) Maximum count of runs to review"
echo " count (int) Maximum count of runs to review (default: 10)"
echo " showAll (bool) Disable pending review runs filter"
exit 1
fi

contestId=$1
if [ "$4" == 'true' ]; then
filter=$2
echo -e "${Red}WARNING${NC} Pending review filter is disabled, don't OK the run uncontrollably!"
filter=$2
if [ 0 -le $3 ]; then
count=$3
else
filter="($2)&&status==PR"
count=10
fi
showAll=$4

if [ $contestId -le 31 ]; then
contestId=$((contestId+templateContestId))
fi

if [[ $filter =~ ^[A-Za-z]$ ]]; then
filter="prob=='$filter'"
elif [[ $filter =~ ^[0-9]+$ ]]; then
filter="prob=='$filter'"
showAll='true'
fi

if [ "$4" != 'true' ]; then
filter="($filter)&&status==PR"
fi
count=$3

cleanup() {
if [ -d "$contestId" ]; then
Expand All @@ -44,6 +61,10 @@ cleanup
echo -e "${Cyan}INFO${NC} Filtering runs from contest [$contestId] with filter [$filter] and limit [$count]"
echo -e "${Cyan}INFO${NC} Reviewing ${IYellow}[$(boban -i "$contestId" -f "$filter" -c "$count" -e -d . | wc -l | xargs)]${NC} filtered runs"

if [ "$4" == 'true' ]; then
echo -e "${Red}WARNING${NC} Pending review filter is disabled, be aware for OK wrong run!"
fi

for file in "$contestId"/*; do
if [ -f "$file" ]; then
filename=$(basename "$file")
Expand Down

0 comments on commit afbeba4

Please sign in to comment.