From 8abaaf6624727eaeea17cfdbc9e307b5a0c65e7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Le=20Bihan?= Date: Fri, 15 Sep 2023 19:02:37 +0200 Subject: [PATCH] style the scaling not working to fix --- back/src/auth/auth.controller.ts | 4 ++-- back/test/robot/auth/auth.robot | 2 +- front/components/PartitionView.tsx | 1 + front/components/PartitionVisualizer/PhaserCanvas.tsx | 5 ++++- front/views/AuthenticationView.tsx | 2 +- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/back/src/auth/auth.controller.ts b/back/src/auth/auth.controller.ts index 2634b42..c68aab4 100644 --- a/back/src/auth/auth.controller.ts +++ b/back/src/auth/auth.controller.ts @@ -7,7 +7,7 @@ import { Body, Delete, BadRequestException, - UnprocessableEntityException, + DuplicateException, HttpCode, Put, InternalServerErrorException, @@ -77,7 +77,7 @@ export class AuthController { } catch (e) { // check if the error is a duplicate key error if (e.code === 'P2002') { - throw new UnprocessableEntityException('Username or email already taken'); + throw new DuplicateException('Username or email already taken'); } console.error(e); throw new BadRequestException(); diff --git a/back/test/robot/auth/auth.robot b/back/test/robot/auth/auth.robot index a4b1071..7d39b97 100644 --- a/back/test/robot/auth/auth.robot +++ b/back/test/robot/auth/auth.robot @@ -30,7 +30,7 @@ Register Duplicates # We can't use the `Register` keyword because it assert for success POST /auth/register {"username": "user-duplicate", "password": "pass", "email": "mail@kyoo.moe"} Output - Integer response status 422 + Integer response status 409 Login user-duplicate [Teardown] DELETE /auth/me diff --git a/front/components/PartitionView.tsx b/front/components/PartitionView.tsx index 659a158..daf5260 100644 --- a/front/components/PartitionView.tsx +++ b/front/components/PartitionView.tsx @@ -60,6 +60,7 @@ const PartitionView = (props: PartitionViewProps) => { const bpm = _osmd.Sheet.HasBPMInfo ? _osmd.Sheet.getExpressionsStartTempoInBPM() : 60; const wholeNoteLength = Math.round((60 / bpm) * 4000); const curPos = []; + _osmd.setLogLevel('info'); while (!_osmd.cursor.iterator.EndReached) { const notesToPlay = _osmd.cursor .NotesUnderCursor() diff --git a/front/components/PartitionVisualizer/PhaserCanvas.tsx b/front/components/PartitionVisualizer/PhaserCanvas.tsx index 7974f74..e473872 100644 --- a/front/components/PartitionVisualizer/PhaserCanvas.tsx +++ b/front/components/PartitionVisualizer/PhaserCanvas.tsx @@ -75,8 +75,11 @@ const getPianoScene = ( if (this.nbTextureToload > 0) return; this.partition = this.add.image(0, 0, 'partition').setOrigin(0, 0); this.cameras.main.setBounds(0, 0, this.partition.width, this.partition.height); + console.log("canvas", this.partition.width, this.partition.height); - this.cursor = this.add.rectangle(0, 0, 30, 350, 0x31ef8c, 0.5).setOrigin(0, 0); + const dims = this.partition.getBounds(); + // base ref normal cursor is 350px by 30px + this.cursor = this.add.rectangle(0, 0, dims.height * 30 / 350, dims.height, 0x31ef8c, 0.5).setOrigin(0, 0); this.cameras.main.startFollow(this.cursor, true, 0.05, 0.05); this.emitter = this.add.particles(0, 0, 'star', { diff --git a/front/views/AuthenticationView.tsx b/front/views/AuthenticationView.tsx index 340516c..36ff7b9 100644 --- a/front/views/AuthenticationView.tsx +++ b/front/views/AuthenticationView.tsx @@ -38,7 +38,7 @@ const handleSignup = async ( return translate('loggedIn'); } catch (error) { if (error instanceof APIError) { - if (error.status === 422) return translate('usernameTaken'); + if (error.status === 409) return translate('usernameTaken'); return translate(error.userMessage); } if (error instanceof Error) return error.message;