Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(hltb): add offset, main+extra and simplify managing (#4173)
Fixes #4171
- Loading branch information
Showing
14 changed files
with
610 additions
and
230 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,3 @@ | ||
###### CHECKLIST | ||
|
||
<!-- Remove items that do not apply. For completed items, change [ ] to [x]. --> | ||
|
||
- [ ] tests are changed or added | ||
- [ ] documentation is changed or added | ||
- [ ] locales are changed or added | ||
- [ ] db relationship (tools/database) are changed or added | ||
- [ ] commit message follows [commit guidelines](https://github.com/sogehige/sogeBot/blob/master/CONTRIBUTING.md#commit-guidelines) | ||
- [ ] I read [contributing docs](https://github.com/sogehige/sogeBot/blob/master/CONTRIBUTING.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"error": "$sender, $game not found in db or is multiplayer game.", | ||
"game": "$sender, $game | Main$doneMain: $currentMain/$hltbMainh - $percentMain% | Completionist$doneCompletionist: $currentCompletionist/$hltbCompletionisth - $percentCompletionist%", | ||
"done": "(done)" | ||
"error": "$sender, $game not found in db.", | ||
"game": "$sender, $game | Main: $currentMain/$hltbMainh - $percentMain% | Main+Extra: $currentMainExtra/$hltbMainExtrah - $percentMainExtra% | Completionist: $currentCompletionist/$hltbCompletionisth - $percentCompletionist%", | ||
"multiplayer-game": "$sender, $game | Main: $currentMainh | Main+Extra: $currentMainExtrah | Completionist: $currentCompletionisth" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,18 @@ | ||
{ | ||
"settings": { | ||
"enabled": "Status" | ||
} | ||
}, | ||
"empty": "No games were tracked yet.", | ||
"emptyAfterSearch": "No tracked games were found by your search for <strong>\"$search\"</strong>.", | ||
"when": "When streamed", | ||
"time": "Tracked time", | ||
"offset": "Offset of tracked time", | ||
"main": "Main", | ||
"extra": "Main+Extra", | ||
"completionist": "Completionist", | ||
"game": "Tracked game", | ||
"startedAt": "Tracking started at", | ||
"showHistory": "Show history ($count)", | ||
"hideHistory": "Hide history ($count)", | ||
"searchToAddNewGame": "Search to add new game to track" | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/bot/database/migration/mysql/1602499070262-hltbRefactor.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import {MigrationInterface, QueryRunner} from 'typeorm'; | ||
|
||
export class hltbRefactor1602499070262 implements MigrationInterface { | ||
name = 'hltbRefactor1602499070262'; | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`DROP TABLE \`how_long_to_beat_game\``, undefined); | ||
await queryRunner.query('CREATE TABLE `how_long_to_beat_game` (`id` varchar(36) NOT NULL, `game` varchar(255) NOT NULL, `imageUrl` varchar(255) NOT NULL, `startedAt` bigint NOT NULL, `gameplayMain` float(12) NOT NULL DEFAULT 0, `gameplayCompletionist` float(12) NOT NULL DEFAULT 0, UNIQUE INDEX `IDX_301758e0e3108fc902d5436527` (`game`), PRIMARY KEY (`id`)) ENGINE=InnoDB'); | ||
await queryRunner.query('CREATE TABLE `how_long_to_beat_game_item` (`id` varchar(36) NOT NULL, `hltb_id` int NOT NULL, `createdAt` bigint NOT NULL, `timestamp` bigint NOT NULL DEFAULT 0, `offset` bigint NOT NULL DEFAULT 0, `isMainCounted` tinyint NOT NULL DEFAULT 0, `isCompletionistCounted` tinyint NOT NULL DEFAULT 0, INDEX `IDX_hltb_id` (`hltb_id`), PRIMARY KEY (`id`)) ENGINE=InnoDB'); | ||
await queryRunner.query('ALTER TABLE `how_long_to_beat_game` ADD `gameplayMainExtra` float(12) NOT NULL DEFAULT 0'); | ||
await queryRunner.query('ALTER TABLE `how_long_to_beat_game_item` ADD `isExtraCounted` tinyint NOT NULL DEFAULT 0'); | ||
await queryRunner.query('ALTER TABLE `how_long_to_beat_game` ADD `offset` bigint NOT NULL DEFAULT 0'); | ||
|
||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query('DROP INDEX `IDX_hltb_id` ON `how_long_to_beat_game_item`'); | ||
await queryRunner.query('DROP TABLE `how_long_to_beat_game_item`'); | ||
await queryRunner.query('DROP INDEX `IDX_301758e0e3108fc902d5436527` ON `how_long_to_beat_game`'); | ||
await queryRunner.query('DROP TABLE `how_long_to_beat_game`'); | ||
await queryRunner.query('CREATE TABLE `how_long_to_beat_game` (`id` int NOT NULL AUTO_INCREMENT, `game` varchar(255) NOT NULL, `startedAt` bigint NOT NULL DEFAULT 0, `isFinishedMain` tinyint NOT NULL, `isFinishedCompletionist` tinyint NOT NULL, `timeToBeatMain` bigint NOT NULL DEFAULT 0, `timeToBeatCompletionist` bigint NOT NULL DEFAULT 0, `gameplayMain` float NOT NULL DEFAULT 0, `gameplayCompletionist` float NOT NULL DEFAULT 0, `imageUrl` varchar(255) NOT NULL, UNIQUE INDEX `IDX_301758e0e3108fc902d5436527` (`game`), PRIMARY KEY (`id`)) ENGINE=InnoDB', undefined); | ||
} | ||
|
||
} |
26 changes: 26 additions & 0 deletions
26
src/bot/database/migration/postgres/1602499070262-hltbRefactor.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import {MigrationInterface, QueryRunner} from 'typeorm'; | ||
|
||
export class hltbRefactor1602499070262 implements MigrationInterface { | ||
name = 'hltbRefactor1602499070262'; | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`DROP TABLE "how_long_to_beat_game"`, undefined); | ||
await queryRunner.query(`CREATE TABLE "how_long_to_beat_game_item" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "hltb_id" integer NOT NULL, "createdAt" bigint NOT NULL, "timestamp" bigint NOT NULL DEFAULT 0, "offset" bigint NOT NULL DEFAULT 0, "isMainCounted" boolean NOT NULL DEFAULT false, "isCompletionistCounted" boolean NOT NULL DEFAULT false, CONSTRAINT "PK_920cb816276ba242619a4f40326" PRIMARY KEY ("id"))`); | ||
await queryRunner.query(`CREATE TABLE "how_long_to_beat_game" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "game" character varying NOT NULL, "startedAt" bigint NOT NULL, "gameplayMain" double precision NOT NULL DEFAULT 0, "gameplayCompletionist" double precision NOT NULL DEFAULT 0, "imageUrl" character varying NOT NULL, CONSTRAINT "PK_c6fbf5fc15e97e46c2659dccea1" PRIMARY KEY ("id"))`, undefined); | ||
await queryRunner.query(`CREATE UNIQUE INDEX "IDX_301758e0e3108fc902d5436527" ON "how_long_to_beat_game" ("game") `, undefined); | ||
await queryRunner.query(`CREATE INDEX "IDX_hltb_id" ON "how_long_to_beat_game_item" ("hltb_id") `); | ||
await queryRunner.query(`ALTER TABLE "how_long_to_beat_game" ADD "gameplayMainExtra" double precision NOT NULL DEFAULT 0`); | ||
await queryRunner.query(`ALTER TABLE "how_long_to_beat_game_item" ADD "isExtraCounted" boolean NOT NULL DEFAULT false`); | ||
await queryRunner.query(`ALTER TABLE "how_long_to_beat_game" ADD "offset" bigint NOT NULL DEFAULT 0`); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`DROP INDEX "IDX_301758e0e3108fc902d5436527"`); | ||
await queryRunner.query(`DROP INDEX "IDX_hltb_id"`); | ||
await queryRunner.query(`DROP TABLE "how_long_to_beat_game_item"`); | ||
await queryRunner.query(`DROP TABLE "how_long_to_beat_game"`); | ||
await queryRunner.query(`CREATE TABLE "how_long_to_beat_game" ("id" SERIAL NOT NULL, "game" character varying NOT NULL, "startedAt" bigint NOT NULL DEFAULT 0, "isFinishedMain" boolean NOT NULL, "isFinishedCompletionist" boolean NOT NULL, "timeToBeatMain" bigint NOT NULL DEFAULT 0, "timeToBeatCompletionist" bigint NOT NULL DEFAULT 0, "gameplayMain" double precision NOT NULL DEFAULT 0, "gameplayCompletionist" double precision NOT NULL DEFAULT 0, "imageUrl" character varying NOT NULL, CONSTRAINT "PK_c6fbf5fc15e97e46c2659dccea1" PRIMARY KEY ("id"))`, undefined); | ||
await queryRunner.query(`CREATE UNIQUE INDEX "IDX_301758e0e3108fc902d5436527" ON "how_long_to_beat_game" ("game") `, undefined); | ||
} | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
src/bot/database/migration/sqlite/1602499070262-hltbRefactor.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import {MigrationInterface, QueryRunner} from 'typeorm'; | ||
|
||
export class hltbRefactor1602499070262 implements MigrationInterface { | ||
name = 'hltbRefactor1602499070262'; | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`CREATE TABLE "how_long_to_beat_game_item" ("id" varchar PRIMARY KEY NOT NULL, "hltb_id" integer NOT NULL, "createdAt" bigint NOT NULL, "timestamp" bigint NOT NULL DEFAULT (0), "offset" bigint NOT NULL DEFAULT (0), "isMainCounted" boolean NOT NULL DEFAULT (0), "isExtraCounted" boolean NOT NULL DEFAULT (0), "isCompletionistCounted" boolean NOT NULL DEFAULT (0))`); | ||
await queryRunner.query(`CREATE INDEX "IDX_hltb_id" ON "how_long_to_beat_game_item" ("hltb_id") `); | ||
await queryRunner.query(`DROP INDEX "IDX_301758e0e3108fc902d5436527"`); | ||
await queryRunner.query(`DROP TABLE "how_long_to_beat_game"`); | ||
await queryRunner.query(`CREATE TABLE "how_long_to_beat_game" ("id" varchar PRIMARY KEY NOT NULL, "game" varchar NOT NULL, "startedAt" bigint NOT NULL, "gameplayMain" float NOT NULL DEFAULT (0), "gameplayCompletionist" float NOT NULL DEFAULT (0), "gameplayMainExtra" float NOT NULL DEFAULT (0), "imageUrl" varchar NOT NULL, "offset" bigint NOT NULL DEFAULT (0))`); | ||
await queryRunner.query(`CREATE UNIQUE INDEX "IDX_301758e0e3108fc902d5436527" ON "how_long_to_beat_game" ("game") `); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`DROP INDEX "IDX_301758e0e3108fc902d5436527"`); | ||
await queryRunner.query(`DROP INDEX "IDX_hltb_id"`); | ||
await queryRunner.query(`DROP TABLE "how_long_to_beat_game_item"`); | ||
await queryRunner.query(`DROP TABLE "how_long_to_beat_game"`); | ||
await queryRunner.query(`CREATE TABLE "how_long_to_beat_game" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "game" varchar NOT NULL, "startedAt" bigint NOT NULL DEFAULT (0), "gameplayMain" float NOT NULL DEFAULT (0), "gameplayCompletionist" float NOT NULL DEFAULT (0), "imageUrl" varchar NOT NULL)`); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.