Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .claude/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": "0.0.1",
"configurations": [
{
"name": "codekata-dev",
"runtimeExecutable": "bin/rails",
"runtimeArgs": ["s", "-p", "3000"],
"port": 3000,
"url": "http://localhost:3000"
}
]
}
58 changes: 58 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Test

on:
pull_request:
push:
branches: [main]

jobs:
test:
runs-on: ubuntu-latest

services:
postgres:
image: postgres:16
env:
POSTGRES_USER: chaiaurcode
POSTGRES_PASSWORD: chaiaurcode
POSTGRES_DB: battle_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis:latest
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5

env:
RAILS_ENV: test
DATABASE_URL: postgresql://chaiaurcode:chaiaurcode@localhost:5432/battle_test
REDIS_URL: redis://localhost:6379/0

steps:
- name: Check out code
uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.2.2"
bundler-cache: true

- name: Set up database
run: bin/rails db:schema:load

- name: Build Tailwind CSS
run: bin/rails tailwindcss:build

- name: Run tests
run: bin/rails test
12 changes: 12 additions & 0 deletions CONTEXT.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ A single coding round within a Game. Each Round has one Challenge assigned at ra
- **Round Winner**: the User who passes all tests first in a given Round (nullable until Round is completed)
- Avoid: "stage", "level" — use "Round" or "Game Round"

### Mock
A solo, timed session on a fixed Paper. The system picks Challenges for the Paper's mix (unsolved first), starts a server-side countdown, and scores the Mock when it finishes — on the last solve, on "Finish now", or lazily on the first request after the deadline. A Mock moves `in_progress` → `finished`; a User has at most one `in_progress` Mock. Mock scores never change a User's Score.

- **Mock Score**: 10 / 20 / 30 per solved easy / medium / hard Challenge, plus up to 20% time bonus when every Challenge is solved
- **Personal best**: the highest Mock Score a User has on a given Paper
- Avoid: "exam", "test", "quiz" — use "Mock"

### Paper
A code-defined preset a Mock is taken on: a challenge mix and a duration (Sprint: 3 easy / 20 min; Standard: 2 easy + 2 medium / 45 min; Marathon: 2 easy + 4 medium / 90 min).

- Avoid: "template", "format" — use "Paper"

### Score
A numeric value on each User that accumulates across completed Games. Winning a Game earns: `rounds_won + 3 (bonus) + min(opponent_score / 20, 50) - rounds_lost`. Losing earns: `rounds_won` (floored at 0). Score never decreases below 0.

Expand Down
2 changes: 1 addition & 1 deletion app/assets/images/bell.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading