Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

more games #198

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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
25 changes: 25 additions & 0 deletions resources/data_migrations/data_type_migration.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
(ns data-migrations.data-type-migration
(:require [byf.db :as db]
[honeysql.core :as sql]
[honeysql.helpers :as h]
[clojure.java.jdbc :as jdbc]
[byf.generators :as gen]))

;; first create all the games supported and then get all the leagues
;; and set the game_kind field accordingly

(def kinds
[{:name "fifa"
:draw-allowed true
:min-points 0
:max-points 10}

{:name "pool"
:draw-allowed false
:min-points 0
:max-points 2}

{:name "table-tennis"
:draw-allowed false
:min-points 0
:max-points 4}])
Empty file.
8 changes: 8 additions & 0 deletions resources/migrations/20191211111544-game-type-table.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CREATE TABLE game_kind (
id UUID PRIMARY KEY,
name VARCHAR(16) NOT NULL,
config JSONB NOT NULL
);

ALTER TABLE league
ADD COLUMN game_kind UUID REFERENCES game_kind(id);
2 changes: 1 addition & 1 deletion src/clj/byf/pages/header.clj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
(defn gen-header
[title]
[:head [:meta {:charset "utf-8"
:description "FIFA championship little helper"}]
:description "Internal leagues platform"}]

[:script (format "window['cfg']=%s" (global-client-side-config))]

Expand Down
48 changes: 31 additions & 17 deletions src/cljc/byf/shared_config.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,44 @@

(def timestamp-format "YYYY-MM-DDZHH:mm:SS")

(def games #{"fifa" "street-fighter" "table-tennis"})
(def games #{"fifa"
"street-fighter"
"table-tennis"
"pool"})

;;TODO: add a spec for the game configuration
(def games-config
{:fifa
{:terminology {:using "team"
:points "goals"}
:form {:points (range 10)}
:logo "fifa.png"
:draw? true}
{:terminology {:using "team"
:points "goals"}
:team-required true
:form {:points (range 10)}
:logo "fifa.png"
:draw? true}

:street-fighter
{:terminology {:using "character"
:points "rounds"}
:form {:points (range 3)}
:logo "street_fighter.gif"
:draw? false}

{:terminology {:using "character"
:points "rounds"}
:form {:points (range 3)}
:team-required true
:logo "street_fighter.gif"
:draw? false}

:table-tennis
{:terminology {:using "player"
:points "games"}
:form {:points (range 6)}
:logo "table_tennis.png"
:draw? false}})
{:terminology {:using "player"
:points "games"}
:team-required false
:form {:points (range 6)}
:logo "table_tennis.png"
:draw? false}

:pool
{:terminology {:using "player"
:points "games"}
:team-required false
:form {:points (range 3)}
:logo "pool.jpg"
:draw? false}})

(defn term
[game k]
Expand Down