updated project 2

This commit is contained in:
Hugh Ratsch
2025-02-09 02:33:45 -06:00
parent 37c1f9c1c9
commit 8988f308c5
5 changed files with 79 additions and 48 deletions
@@ -60,18 +60,8 @@ log_message() {
local severity=$1
local message=$2
local timestamp=$(date '+%Y-%m-%d %H:%M:%S')
local color
case $severity in
"INFO") color=$BLUE ;;
"SUCCESS") color=$GREEN ;;
"WARNING") color=$YELLOW ;;
"ERROR") color=$RED ;;
*) color=$NC ;;
esac
echo -e "${color}[$severity]${NC} $message"
echo "[$timestamp] [$severity] $message" >> "$LOG_FILE"
echo "[$timestamp] [$severity] $message" >> "$DATA_DIR/challenge.log"
echo -e "${BLUE}[$severity]${NC} $message"
}
# Initialize environment with comprehensive setup
@@ -254,6 +244,14 @@ show_recommendations() {
# Check if challenge is completed
is_challenge_completed() {
local challenge=$1
grep -q "^$challenge," "$SCORE_FILE" && return 0
return 1
grep -q "^$challenge," "$SCORE_FILE"
return $?
}
# Award points function
award_points() {
local challenge=$1
local points=$2
echo "$challenge,$points,$(date +%s)" >> "$SCORE_FILE"
log_message "INFO" "Awarded $points points for challenge $challenge"
}