From 97a521ddac34e26738a60bf3a842b7ee8454f79c Mon Sep 17 00:00:00 2001 From: Avior Date: Wed, 19 Jan 2022 11:29:27 +0100 Subject: [PATCH] feat: Add Github Table as SVG (#232) --- README.md | 11 +++------ meta/definitions/graphql.gql | 4 ++++ server/README.md | 42 +++++++++++++++++++++++++++++++++- server/src/status.ts | 44 ++++++++++++++++++++++++++++++++++-- 4 files changed, 90 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 9192a166d..37e61a705 100644 --- a/README.md +++ b/README.md @@ -53,16 +53,11 @@ There is three sub folders that will allow you to edit some faces of the databas - `/meta`: Contains informations for the project (definitions files, Translations for some fields) - `/server`: The server that allow to communicate with the database -## Translations +## Status -We have a big effort on translating datas for older sets +We are making sure to make every cards available for every languages they were available ! -_note: numbers updated manually_ - -| | English | French | German | Italian | Portuguese | Spanish | -|-------------|---------|--------|--------|---------|------------|---------| -| Cards | 14419 | 9846 | 6590 | 6576 | 6593 | 6590 | -| Translated | 100% | 68.2% | 45.7% | 45.6% | 45.7% | 45.7% | +![TCGdex Progress](https://api.tcgdex.net/status/github.svg) _want to help translating? each object fields on cards that have at least en,fr,es,de,it or pt can have the others!,_ _Also we have another translation files located at `meta/translations`_ diff --git a/meta/definitions/graphql.gql b/meta/definitions/graphql.gql index 1b432eae6..085e78d07 100644 --- a/meta/definitions/graphql.gql +++ b/meta/definitions/graphql.gql @@ -64,6 +64,7 @@ type Card { category: String! description: String dexId: [Float] + effect: String energyType: String evolveFrom: String hp: Float @@ -86,6 +87,8 @@ type Card { types: [String] variants: Variants weaknesses: [WeakResListItem] + # Currently not in any cards + # weight: String! } type AbilitiesListItem { @@ -137,6 +140,7 @@ type Set { symbol: String serie: Serie! releaseDate: String! + tcgOnline: String } type CardCount { diff --git a/server/README.md b/server/README.md index b236ffc15..c7d89e741 100644 --- a/server/README.md +++ b/server/README.md @@ -2,4 +2,44 @@ The server running the TCGdex API. -More informations at https://github.com/tcgdex/cards-database#pokemon-tcgdex +## Installing/Running + +### Using NodeJS/NPM + +You will need NPM/NodeJS installed + +1. Install deps for both this directory and the parent directory + +``` +npm install +cd .. +npm install +cd server +``` + +2. Compile the database + +``` +cd .. +npm run compile +cd server +npm run compile +``` + +3. run the server ! + +Dev mode +``` +npm run dev +``` + +Production mode + +``` +npm run build +npm run start +``` + +### Using Docker + +Go to the parent directory and build the Dockerfile! diff --git a/server/src/status.ts b/server/src/status.ts index 45e428ffc..ffe4fb1b7 100644 --- a/server/src/status.ts +++ b/server/src/status.ts @@ -54,8 +54,48 @@ preProcessSets(itStats, 'it') preProcessSets(ptStats, 'pt') preProcessSets(deStats, 'de') - -export default express.Router().get('/', (_, res): void => { +// Yes this is ugly +export default express.Router() +.get('/github.svg', (_, res): void => { + res.setHeader('Content-Type', 'image/svg+xml') + res.send(` + + + English + French + German + Italian + Portuguese + Spanish + Total + Card Progress + ${enStats.count} of ${enStats.total} ${(100 * enStats.count / enStats.total).toFixed(2)}% + ${frStats.count} of ${frStats.total} ${(100 * frStats.count / frStats.total).toFixed(2)}% + ${deStats.count} of ${deStats.total} ${(100 * deStats.count / deStats.total).toFixed(2)}% + ${itStats.count} of ${itStats.total} ${(100 * itStats.count / itStats.total).toFixed(2)}% + ${ptStats.count} of ${ptStats.total} ${(100 * ptStats.count / ptStats.total).toFixed(2)}% + ${esStats.count} of ${esStats.total} ${(100 * esStats.count / esStats.total).toFixed(2)}% + ${totalStats.count} of ${totalStats.total} ${(100 * totalStats.count / totalStats.total).toFixed(2)}% + Images Progress + ${enStats.images} of ${enStats.total} ${(100 * enStats.images / enStats.total).toFixed(2)}% + ${frStats.images} of ${frStats.total} ${(100 * frStats.images / frStats.total).toFixed(2)}% + ${deStats.images} of ${deStats.total} ${(100 * deStats.images / deStats.total).toFixed(2)}% + ${itStats.images} of ${itStats.total} ${(100 * itStats.images / itStats.total).toFixed(2)}% + ${ptStats.images} of ${ptStats.total} ${(100 * ptStats.images / ptStats.total).toFixed(2)}% + ${esStats.images} of ${esStats.total} ${(100 * esStats.images / esStats.total).toFixed(2)}% + ${totalStats.images} of ${totalStats.total} ${(100 * totalStats.images / totalStats.total).toFixed(2)}% + Total Progress + ${enStats.images + enStats.count} of ${enStats.total * 2} ${(100 * (enStats.images + enStats.count) / (enStats.total * 2)).toFixed(2)}% + ${frStats.images + frStats.count} of ${frStats.total * 2} ${(100 * (frStats.images + frStats.count) / (frStats.total * 2)).toFixed(2)}% + ${deStats.images + deStats.count} of ${deStats.total * 2} ${(100 * (deStats.images + deStats.count) / (deStats.total * 2)).toFixed(2)}% + ${itStats.images + itStats.count} of ${itStats.total * 2} ${(100 * (itStats.images + itStats.count) / (itStats.total * 2)).toFixed(2)}% + ${ptStats.images + ptStats.count} of ${ptStats.total * 2} ${(100 * (ptStats.images + ptStats.count) / (ptStats.total * 2)).toFixed(2)}% + ${esStats.images + esStats.count} of ${esStats.total * 2} ${(100 * (esStats.images + esStats.count) / (esStats.total * 2)).toFixed(2)}% + ${totalStats.images + totalStats.count} of ${totalStats.total * 2} ${(100 * (totalStats.images + totalStats.count) / (totalStats.total * 2)).toFixed(2)}% + + `) +}) +.get('/', (_, res): void => { res.send(`