From 703edc85262a16773fa13e6b2c22ec0c2e0f991e Mon Sep 17 00:00:00 2001 From: silas Date: Sun, 21 Oct 2018 18:09:50 +0200 Subject: [PATCH] Gespiegelte Felder werden richtig erkannt --- public/js/app.js | 6 ++++-- .../Application/pwa/js/wordrotator/Segment/LeafSegment.js | 1 + .../Application/pwa/js/wordrotator/Segment/ParentSegment.js | 5 +++-- src/module/Application/src/Controller/SyncController.php | 4 ++-- src/module/Application/src/Model/Manager/LevelManager.php | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/public/js/app.js b/public/js/app.js index 9fdab8a..fb4afa7 100755 --- a/public/js/app.js +++ b/public/js/app.js @@ -5333,6 +5333,7 @@ class LeafSegment extends Segment { } sameAs(otherSegment) { + // debugger; return (otherSegment instanceof LeafSegment && otherSegment.leaf === this.leaf); } @@ -5521,9 +5522,10 @@ class ParentSegment extends Segment { return false; } } + console.log(this.rotation, this.children, this.children[0].sameAs(this.children[3]), this.children[1].sameAs(this.children[2]), this.children[0].sameAs(this.children[1])); return (this.rotation === 0 || ( - this.children[0].sameAs(this.children[2]) && this.children[1].sameAs(this.children[3]) && ( - this.rotation === 2 || this.children[0].sameAs(this.children[1])))) + this.children[0].sameAs(this.children[3]) && this.children[1].sameAs(this.children[2]) && ( + this.rotation === 180 || this.children[0].sameAs(this.children[1])))) } setChildren(children) { diff --git a/src/module/Application/pwa/js/wordrotator/Segment/LeafSegment.js b/src/module/Application/pwa/js/wordrotator/Segment/LeafSegment.js index bcd2935..86ef663 100755 --- a/src/module/Application/pwa/js/wordrotator/Segment/LeafSegment.js +++ b/src/module/Application/pwa/js/wordrotator/Segment/LeafSegment.js @@ -12,6 +12,7 @@ export class LeafSegment extends Segment { } sameAs(otherSegment) { + // debugger; return (otherSegment instanceof LeafSegment && otherSegment.leaf === this.leaf); } diff --git a/src/module/Application/pwa/js/wordrotator/Segment/ParentSegment.js b/src/module/Application/pwa/js/wordrotator/Segment/ParentSegment.js index 21de209..876ab98 100755 --- a/src/module/Application/pwa/js/wordrotator/Segment/ParentSegment.js +++ b/src/module/Application/pwa/js/wordrotator/Segment/ParentSegment.js @@ -177,9 +177,10 @@ export class ParentSegment extends Segment { return false; } } + console.log(this.rotation, this.children, this.children[0].sameAs(this.children[3]), this.children[1].sameAs(this.children[2]), this.children[0].sameAs(this.children[1])); return (this.rotation === 0 || ( - this.children[0].sameAs(this.children[2]) && this.children[1].sameAs(this.children[3]) && ( - this.rotation === 2 || this.children[0].sameAs(this.children[1])))) + this.children[0].sameAs(this.children[3]) && this.children[1].sameAs(this.children[2]) && ( + this.rotation === 180 || this.children[0].sameAs(this.children[1])))) } setChildren(children) { diff --git a/src/module/Application/src/Controller/SyncController.php b/src/module/Application/src/Controller/SyncController.php index 3db032c..7bd4fc7 100755 --- a/src/module/Application/src/Controller/SyncController.php +++ b/src/module/Application/src/Controller/SyncController.php @@ -109,14 +109,14 @@ class SyncController extends JsonController $currentRun = (int)$request->getQuery("currentRun", null); $dateLastSync = $request->getQuery("dateLastSync", null); try { - $dateLastSync = new \DateTime("@" . $dateLastSync); + $dateLastSync = new \DateTime("@" . $dateLastSync, new \DateTimeZone("UTC")); } catch (\Throwable $e) { $dateLastSync = new \DateTime(); } /** @var LevelManager $levelManager */ $levelManager = $this->get(LevelManager::class); - $newDate = new \DateTime(); + $newDate = new \DateTime("now", new \DateTimeZone("UTC")); $levels = $levelManager->levelsToArray($levelManager->findNewerThan($dateLastSync, $currentRun)); $numberLevelsToSync = $levelManager->countNewerThan($dateLastSync); diff --git a/src/module/Application/src/Model/Manager/LevelManager.php b/src/module/Application/src/Model/Manager/LevelManager.php index 141be5b..d8c0e36 100755 --- a/src/module/Application/src/Model/Manager/LevelManager.php +++ b/src/module/Application/src/Model/Manager/LevelManager.php @@ -61,7 +61,7 @@ class LevelManager extends StandardManager "id" => $level->getId(), "words" => json_decode($level->getWords()), "rotations" => json_decode($level->getPositions()), - "lastUpdated" => $level->getLastUpdated()->format("Y-m-d"), + "lastUpdated" => $level->getLastUpdated()->format("Y-m-d H:i:s"), "language" => $level->getLang(), "rendererType" => $level->getRenderer(), "difficulty" => $level->getDifficulty(),