feat: add more challenges to the history module
This commit is contained in:
@@ -59,21 +59,46 @@ if (-not (Test-Path "answers.md")) {
|
||||
$allChecksPassed = $false
|
||||
}
|
||||
|
||||
# Check 3: Contains "auth" keyword for file modified in bug fix
|
||||
if ($answersLower -match "auth") {
|
||||
Write-Host "[PASS] Correct file identified for bug fix commit" -ForegroundColor Green
|
||||
# Check 3: Contains both "auth" and "database" keywords for files modified in bug fix
|
||||
$hasAuth = $answersLower -match "auth"
|
||||
$hasDatabase = $answersLower -match "database"
|
||||
|
||||
if ($hasAuth -and $hasDatabase) {
|
||||
Write-Host "[PASS] Both files identified for bug fix commit" -ForegroundColor Green
|
||||
} elseif ($hasAuth -or $hasDatabase) {
|
||||
Write-Host "[PARTIAL] Only one file found - there are TWO files modified in this commit" -ForegroundColor Yellow
|
||||
Write-Host "[HINT] Use 'git log --stat' or 'git show <commit-hash> --name-only' to see ALL files changed" -ForegroundColor Yellow
|
||||
$allChecksPassed = $false
|
||||
} else {
|
||||
Write-Host "[FAIL] File modified in bug fix commit not found" -ForegroundColor Red
|
||||
Write-Host "[FAIL] Files modified in bug fix commit not found" -ForegroundColor Red
|
||||
Write-Host "[HINT] Use 'git log --stat' to see which files were changed in each commit" -ForegroundColor Yellow
|
||||
$allChecksPassed = $false
|
||||
}
|
||||
|
||||
# Check 4: Some mention of changes (flexible check)
|
||||
if ($answersLower -match "import|profile|function|added|login|connect") {
|
||||
Write-Host "[PASS] Changes to app.py described" -ForegroundColor Green
|
||||
# Check 4: Contains "config" keyword for staged file
|
||||
if ($answersLower -match "config") {
|
||||
Write-Host "[PASS] Staged file identified" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "[FAIL] Changes to app.py not described" -ForegroundColor Red
|
||||
Write-Host "[HINT] Use 'git diff <first-commit> <last-commit> app.py' to see changes" -ForegroundColor Yellow
|
||||
Write-Host "[FAIL] Staged file not identified" -ForegroundColor Red
|
||||
Write-Host "[HINT] Use 'git status' or 'git diff --staged' to see staged changes" -ForegroundColor Yellow
|
||||
$allChecksPassed = $false
|
||||
}
|
||||
|
||||
# Check 5: Contains "unicorn" for the secret code
|
||||
if ($answersLower -match "unicorn") {
|
||||
Write-Host "[PASS] Secret code found!" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "[FAIL] Secret code not found" -ForegroundColor Red
|
||||
Write-Host "[HINT] Use 'git diff <commit3> <commit4> database.py' to find the secret code" -ForegroundColor Yellow
|
||||
$allChecksPassed = $false
|
||||
}
|
||||
|
||||
# Check 6: Some mention of changes between commits (flexible check)
|
||||
if ($answersLower -match "database|connect|disconnect|import|added|validation|error") {
|
||||
Write-Host "[PASS] Changes to app.py between commits described" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "[FAIL] Changes to app.py between commits not described" -ForegroundColor Red
|
||||
Write-Host "[HINT] Use 'git diff <commit2> <commit4> app.py' to see changes between specific commits" -ForegroundColor Yellow
|
||||
$allChecksPassed = $false
|
||||
}
|
||||
}
|
||||
@@ -91,7 +116,8 @@ if ($allChecksPassed) {
|
||||
Write-Host " - View commit history with git log" -ForegroundColor White
|
||||
Write-Host " - Find specific commits and their messages" -ForegroundColor White
|
||||
Write-Host " - See which files changed in commits" -ForegroundColor White
|
||||
Write-Host " - Compare changes between commits with git diff" -ForegroundColor White
|
||||
Write-Host " - Check staged changes with git diff --staged" -ForegroundColor White
|
||||
Write-Host " - Compare changes between specific commits with git diff" -ForegroundColor White
|
||||
Write-Host "`nReady for the next module!" -ForegroundColor Green
|
||||
Write-Host ""
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user