Gespiegelte Felder werden richtig erkannt

This commit is contained in:
silas 2018-10-21 18:09:50 +02:00
parent 0af8f4d7b1
commit 703edc8526
5 changed files with 11 additions and 7 deletions

View File

@ -5333,6 +5333,7 @@ class LeafSegment extends Segment {
} }
sameAs(otherSegment) { sameAs(otherSegment) {
// debugger;
return (otherSegment instanceof LeafSegment && otherSegment.leaf === this.leaf); return (otherSegment instanceof LeafSegment && otherSegment.leaf === this.leaf);
} }
@ -5521,9 +5522,10 @@ class ParentSegment extends Segment {
return false; 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 || ( return (this.rotation === 0 || (
this.children[0].sameAs(this.children[2]) && this.children[1].sameAs(this.children[3]) && ( this.children[0].sameAs(this.children[3]) && this.children[1].sameAs(this.children[2]) && (
this.rotation === 2 || this.children[0].sameAs(this.children[1])))) this.rotation === 180 || this.children[0].sameAs(this.children[1]))))
} }
setChildren(children) { setChildren(children) {

View File

@ -12,6 +12,7 @@ export class LeafSegment extends Segment {
} }
sameAs(otherSegment) { sameAs(otherSegment) {
// debugger;
return (otherSegment instanceof LeafSegment && otherSegment.leaf === this.leaf); return (otherSegment instanceof LeafSegment && otherSegment.leaf === this.leaf);
} }

View File

@ -177,9 +177,10 @@ export class ParentSegment extends Segment {
return false; 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 || ( return (this.rotation === 0 || (
this.children[0].sameAs(this.children[2]) && this.children[1].sameAs(this.children[3]) && ( this.children[0].sameAs(this.children[3]) && this.children[1].sameAs(this.children[2]) && (
this.rotation === 2 || this.children[0].sameAs(this.children[1])))) this.rotation === 180 || this.children[0].sameAs(this.children[1]))))
} }
setChildren(children) { setChildren(children) {

View File

@ -109,14 +109,14 @@ class SyncController extends JsonController
$currentRun = (int)$request->getQuery("currentRun", null); $currentRun = (int)$request->getQuery("currentRun", null);
$dateLastSync = $request->getQuery("dateLastSync", null); $dateLastSync = $request->getQuery("dateLastSync", null);
try { try {
$dateLastSync = new \DateTime("@" . $dateLastSync); $dateLastSync = new \DateTime("@" . $dateLastSync, new \DateTimeZone("UTC"));
} catch (\Throwable $e) { } catch (\Throwable $e) {
$dateLastSync = new \DateTime(); $dateLastSync = new \DateTime();
} }
/** @var LevelManager $levelManager */ /** @var LevelManager $levelManager */
$levelManager = $this->get(LevelManager::class); $levelManager = $this->get(LevelManager::class);
$newDate = new \DateTime(); $newDate = new \DateTime("now", new \DateTimeZone("UTC"));
$levels = $levelManager->levelsToArray($levelManager->findNewerThan($dateLastSync, $currentRun)); $levels = $levelManager->levelsToArray($levelManager->findNewerThan($dateLastSync, $currentRun));
$numberLevelsToSync = $levelManager->countNewerThan($dateLastSync); $numberLevelsToSync = $levelManager->countNewerThan($dateLastSync);

View File

@ -61,7 +61,7 @@ class LevelManager extends StandardManager
"id" => $level->getId(), "id" => $level->getId(),
"words" => json_decode($level->getWords()), "words" => json_decode($level->getWords()),
"rotations" => json_decode($level->getPositions()), "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(), "language" => $level->getLang(),
"rendererType" => $level->getRenderer(), "rendererType" => $level->getRenderer(),
"difficulty" => $level->getDifficulty(), "difficulty" => $level->getDifficulty(),