updated project 2
This commit is contained in:
@@ -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"
|
||||
}
|
||||
Reference in New Issue
Block a user