Skip to content
This repository was archived by the owner on Oct 15, 2025. It is now read-only.
Merged
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
2 changes: 1 addition & 1 deletion assets/controllers/challenge_executor_controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default class extends Controller<HTMLElement> {
const query = editorView.state.doc.toString();

console.debug("Executing query", { query });
await component.action("execute", {
await component.action("createNewQuery", {
query,
});

Expand Down
220 changes: 111 additions & 109 deletions composer.lock

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions devenv.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"devenv": {
"locked": {
"dir": "src/modules",
"lastModified": 1731407985,
"lastModified": 1731501663,
"owner": "cachix",
"repo": "devenv",
"rev": "9d3bf4d4c3fef89d2b6b29ebd64047a29ee932ea",
"rev": "b48b0d8018e0dc8c14d9dca47cd6e55add94a603",
"type": "github"
},
"original": {
Expand Down Expand Up @@ -53,10 +53,10 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1731245184,
"lastModified": 1731531548,
"owner": "nixos",
"repo": "nixpkgs",
"rev": "aebe249544837ce42588aa4b2e7972222ba12e8f",
"rev": "24f0d4acd634792badd6470134c387a3b039dace",
"type": "github"
},
"original": {
Expand All @@ -68,10 +68,10 @@
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1731239293,
"lastModified": 1731386116,
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "9256f7c71a195ebe7a218043d9f93390d49e6884",
"rev": "689fed12a013f56d4c4d3f612489634267d86529",
"type": "github"
},
"original": {
Expand Down
1 change: 1 addition & 0 deletions frankenphp/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ if [ "$1" = 'frankenphp' ] || [ "$1" = 'php' ] || [ "$1" = 'bin/console' ]; then
php bin/console cache:pool:clear cache.dbrunner || true

echo "Updating Meilisearch indexes..."
php bin/console meili:clear || true
php bin/console meili:import --update-settings || true

setfacl -R -m u:www-data:rwX -m u:"$(whoami)":rwX var
Expand Down
2 changes: 1 addition & 1 deletion importmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
'version' => '6.5.7',
],
'@codemirror/autocomplete' => [
'version' => '6.18.2',
'version' => '6.18.3',
],
'@codemirror/lint' => [
'version' => '6.8.2',
Expand Down
18 changes: 9 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions src/Entity/ChallengeDto/CompareResult/ColumnDifferent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

declare(strict_types=1);

namespace App\Entity\ChallengeDto\CompareResult;

use Symfony\Component\Translation\TranslatableMessage;

use function Symfony\Component\Translation\t;

/**
* The columns name (first row) is different.
*/
readonly class ColumnDifferent implements CompareResult
{
public function correct(): bool
{
return false;
}

public function reason(): TranslatableMessage
{
return t('challenge.compare-result.column-different');
}
}
17 changes: 17 additions & 0 deletions src/Entity/ChallengeDto/CompareResult/CompareResult.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

declare(strict_types=1);

namespace App\Entity\ChallengeDto\CompareResult;

use Symfony\Component\Translation\TranslatableMessage;

/**
* The result of a comparison.
*/
interface CompareResult
{
public function correct(): bool;

public function reason(): TranslatableMessage;
}
22 changes: 22 additions & 0 deletions src/Entity/ChallengeDto/CompareResult/EmptyAnswer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

namespace App\Entity\ChallengeDto\CompareResult;

use Symfony\Component\Translation\TranslatableMessage;

use function Symfony\Component\Translation\t;

readonly class EmptyAnswer implements CompareResult
{
public function correct(): bool
{
return false;
}

public function reason(): TranslatableMessage
{
return t('challenge.compare-result.empty-answer');
}
}
22 changes: 22 additions & 0 deletions src/Entity/ChallengeDto/CompareResult/EmptyResult.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

namespace App\Entity\ChallengeDto\CompareResult;

use Symfony\Component\Translation\TranslatableMessage;

use function Symfony\Component\Translation\t;

readonly class EmptyResult implements CompareResult
{
public function correct(): bool
{
return false;
}

public function reason(): TranslatableMessage
{
return t('challenge.compare-result.empty-result');
}
}
31 changes: 31 additions & 0 deletions src/Entity/ChallengeDto/CompareResult/RowDifferent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);

namespace App\Entity\ChallengeDto\CompareResult;

use Symfony\Component\Translation\TranslatableMessage;

use function Symfony\Component\Translation\t;

readonly class RowDifferent implements CompareResult
{
/**
* @param int $row the row number that is different
*/
public function __construct(public int $row)
{
}

public function correct(): bool
{
return false;
}

public function reason(): TranslatableMessage
{
return t('challenge.compare-result.row-different', [
'%row%' => $this->row,
]);
}
}
35 changes: 35 additions & 0 deletions src/Entity/ChallengeDto/CompareResult/RowUnmatched.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

declare(strict_types=1);

namespace App\Entity\ChallengeDto\CompareResult;

use Symfony\Component\Translation\TranslatableMessage;

use function Symfony\Component\Translation\t;

readonly class RowUnmatched implements CompareResult
{
/**
* @param int $expected the expected row number
* @param int $actual the actual row number
*/
public function __construct(
public int $expected,
public int $actual,
) {
}

public function correct(): bool
{
return false;
}

public function reason(): TranslatableMessage
{
return t('challenge.compare-result.row-unmatched', [
'%expected%' => $this->expected,
'%actual%' => $this->actual,
]);
}
}
25 changes: 25 additions & 0 deletions src/Entity/ChallengeDto/CompareResult/Same.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

declare(strict_types=1);

namespace App\Entity\ChallengeDto\CompareResult;

use Symfony\Component\Translation\TranslatableMessage;

use function Symfony\Component\Translation\t;

/**
* There is no different.
*/
readonly class Same implements CompareResult
{
public function correct(): bool
{
return true;
}

public function reason(): TranslatableMessage
{
return t('challenge.compare-result.same');
}
}
42 changes: 42 additions & 0 deletions src/Entity/ChallengeDto/FallableQueryResultDto.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

declare(strict_types=1);

namespace App\Entity\ChallengeDto;

use Symfony\Component\Translation\TranslatableMessage;

/**
* A DTO for the result of a query that may contain the error from DbRunner.
*
* If there is no error, the errorCode will be 0.
*/
class FallableQueryResultDto
{
public ?QueryResultDto $result = null;
public ?TranslatableMessage $errorMessage = null;

public function getResult(): ?QueryResultDto
{
return $this->result;
}

public function setResult(?QueryResultDto $result): self
{
$this->result = $result;

return $this;
}

public function getErrorMessage(): ?TranslatableMessage
{
return $this->errorMessage;
}

public function setErrorMessage(?TranslatableMessage $errorMessage): self
{
$this->errorMessage = $errorMessage;

return $this;
}
}
36 changes: 36 additions & 0 deletions src/Entity/ChallengeDto/QueryResultDto.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

declare(strict_types=1);

namespace App\Entity\ChallengeDto;

use App\Service\DbRunner;

/**
* The typed wrapper for the result of a query from {@link DbRunner}.
*/
class QueryResultDto
{
/**
* @var array<array<int, string>> the result of the user's query
*/
private array $result;

/**
* @return array<array<int, string>> the result of the user's query
*/
public function getResult(): array
{
return $this->result;
}

/**
* @param array<array<int, string>> $result the result of the user's query
*/
public function setResult(array $result): self
{
$this->result = $result;

return $this;
}
}
Loading