Skip to content

Conversation

@JJ-8
Copy link
Collaborator

@JJ-8 JJ-8 commented May 5, 2023

Now the form can't be submitted before this is fixed. This is also enforced by the database.

Credits to DU4L#52

Now the form can't be submitted before this is fixed.
This is also enforced by the database.

Credits to DU4L#52
JJ-8 added a commit to JJ-8/CTFNote that referenced this pull request May 5, 2023
The implementation is mostly based on DU4L#16
but we update the timer in the database instead of the frontend.
The update is done when the user fetches the profile,
so for every first load done in a new tab in the browser.

Please note that this commit can NOT be merged before TFNS#213
is merged since the migration files are now not consecutive.
The other PR contains a migration with ID 41, so this PR has a migration
with ID 42 (and this answers everything of course).
The migration will fail in this branch therefore. For testing, please
rename the file and use a throw away database.
@JJ-8 JJ-8 requested a review from XeR May 5, 2023 19:47
@JJ-8 JJ-8 mentioned this pull request May 7, 2023
Without this fix, CTFNote will crash in the unlikely event that an invalid CTF
exists:
```
/app/node_modules/postgres-migrations/dist/migrate.js:100
            const error = new Error(`Migration failed. Reason: ${e.message}`);
                          ^

Error: Migration failed. Reason: An error occurred running 'illegal-dates'. Rolled back this migration. No further migrations were run. Reason: check constraint "no_illegal_end_time" of relation "ctf" is violated by some row
    at /app/node_modules/postgres-migrations/dist/migrate.js:100:27
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async /app/node_modules/postgres-migrations/dist/with-lock.js:25:28
    at async /app/node_modules/postgres-migrations/dist/with-connection.js:16:28 {
  cause: Error: An error occurred running 'illegal-dates'. Rolled back this migration. No further migrations were run. Reason: check constraint "no_illegal_end_time" of relation "ctf" is violated by some row
      at /app/node_modules/postgres-migrations/dist/run-migration.js:36:15
      at processTicksAndRejections (node:internal/process/task_queues:96:5)
      at async /app/node_modules/postgres-migrations/dist/migrate.js:91:32
      at async /app/node_modules/postgres-migrations/dist/with-lock.js:25:28
      at async /app/node_modules/postgres-migrations/dist/with-connection.js:16:28
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
```
@XeR
Copy link
Contributor

XeR commented May 8, 2023

See JJ-8#31

I tried to push my commit on your branch, but it looks like you locked this branch.

To github.com:JJ-8/CTFNote.git
 ! [remote rejected]   HEAD -> 0-fix-illegal-dates (permission denied)
error: failed to push some refs to 'github.com:JJ-8/CTFNote.git'

Update CTF end date if before start date
@JJ-8
Copy link
Collaborator Author

JJ-8 commented May 9, 2023

@XeR, good catch! Your commit is added to the branch.

@XeR XeR merged commit a39165d into TFNS:main May 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants