bugfix
This commit is contained in:
parent
703edc8526
commit
98fc403e9e
1
.idea/php.xml
generated
1
.idea/php.xml
generated
@ -91,4 +91,5 @@
|
||||
<path value="$PROJECT_DIR$/vendor/ainias/pwa-zf-core" />
|
||||
</include_path>
|
||||
</component>
|
||||
<component name="PhpProjectSharedConfiguration" php_language_level="7" />
|
||||
</project>
|
||||
1
.idea/wordRotator.iml
generated
1
.idea/wordRotator.iml
generated
@ -4,6 +4,7 @@
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/module/Application/src" isTestSource="false" packagePrefix="Application\" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/public/js" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/publicTest" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/event-manager" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/persistence" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/reflection" />
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true,
|
||||
"require": {
|
||||
"php": "^5.6 || ^7.0",
|
||||
"php": "^7.0",
|
||||
"zendframework/zend-component-installer": "^1.0 || ^0.7 || ^1.0.0-dev@dev",
|
||||
"zendframework/zend-mvc": "^3.0.1",
|
||||
"zfcampus/zf-development-mode": "^3.0",
|
||||
|
||||
@ -76,7 +76,7 @@ INSERT INTO `RoleAccess` (`RoleId`, `AccessId`) VALUES (3, 4); -- admin - admin
|
||||
|
||||
INSERT INTO `Level` (`id`, `words`, `positions`, `renderer`, `lastUpdated`, `lang`, `deleted`, `difficulty`) VALUES
|
||||
(15, '["ARCHIV","CHARME"]', '[1,1,3]', 20, '2018-07-14 17:01:18', 1, 0, 2),
|
||||
(26, '["BODENSEE","ALARMRUF"]', '[3,2,0,3]', 40, '2018-07-14 17:01:18', 1, 0, 40),
|
||||
(26, '["BRAUEREI","THERAPIE"]', '[3,2,0,1]', 40, '2018-07-14 17:01:18', 1, 0, 40),
|
||||
(217, '["ZEITSTRAFE","HOCHSAISON"]', '[1,0,3,3,1]', 60, '2018-07-14 17:01:18', 1, 0, 60),
|
||||
(220, '["FEINGUSS","R\\u00dcCKFALL","PHYSIKER","RESIDENZ","BERATUNG","KOCHTOPF"]', '[2,0,0,1,2,2,3,3,2,1,1,2,0,0]', 100, '2018-07-14 17:01:18', 1, 0, 100),
|
||||
(24, '["BETONUNG","ANBETUNG","ALLERGIE","BAUMHAUS"]', '[0,3,1,1,3,1,2,0,0,0]', 120, '2018-07-14 17:01:18', 1, 0, 120),
|
||||
|
||||
@ -5516,13 +5516,15 @@ class ParentSegment extends Segment {
|
||||
return locked;
|
||||
}
|
||||
|
||||
isSolved() {
|
||||
for (let i = 0, n = this.children.length; i < n; i++) {
|
||||
if (!this.children[i].isSolved()) {
|
||||
return false;
|
||||
isSolved(checkChildren) {
|
||||
checkChildren = Helper.nonNull(checkChildren, true);
|
||||
if (checkChildren) {
|
||||
for (let i = 0, n = this.children.length; i < n; i++) {
|
||||
if (!this.children[i].isSolved()) {
|
||||
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[3]) && this.children[1].sameAs(this.children[2]) && (
|
||||
this.rotation === 180 || this.children[0].sameAs(this.children[1]))))
|
||||
@ -5698,7 +5700,7 @@ class Level {
|
||||
if (this.rootSegment.isSolved()){
|
||||
this.hasWon = true;
|
||||
const self = this;
|
||||
delayPromise.then(()=>{
|
||||
Promise.resolve(delayPromise).then(()=>{
|
||||
self.wonResolver(true);
|
||||
});
|
||||
return true;
|
||||
@ -6193,11 +6195,10 @@ class LevelSite extends WordRotatorBaseSite {
|
||||
this.coinPromise = Promise.resolve();
|
||||
|
||||
let settingsManager = SettingsManager.getInstance();
|
||||
|
||||
let soundManager = SoundManager.getInstance();
|
||||
soundManager.set({
|
||||
audio: "sound/single_coin_fall_on_concrete_.mp3",
|
||||
muted: !settingsManager.getSetting("play-sound", true),
|
||||
muted: (settingsManager.getSetting("play-sound", "1") !== "1"),
|
||||
volume: 0.7
|
||||
}, SoundManager.CHANNELS.SOUND);
|
||||
|
||||
@ -6294,6 +6295,7 @@ class LevelSite extends WordRotatorBaseSite {
|
||||
this.level = level;
|
||||
let res = this.tutorial();
|
||||
Matomo.push(["trackEvent", "LevelSite", "LoadLastLevel"]);
|
||||
this.level.checkHasWon();
|
||||
return res;
|
||||
}
|
||||
}
|
||||
@ -6342,10 +6344,10 @@ class LevelSite extends WordRotatorBaseSite {
|
||||
this.wonParams.aborted = true;
|
||||
clearTimeout(this.wonParams.coinCounterTimer);
|
||||
|
||||
//LevelCounter * 2 - 1, damit der durchschnittswert stimmt
|
||||
// Matomo.push(["trackEvent", "LevelSite", "NextLevel", "Level Number Average", this.levelCounter*2-1]);
|
||||
Matomo.push(["trackEvent", "LevelSite", "NextLevel", "Level Number Normal", this.levelCounter]);
|
||||
|
||||
this.level.checkHasWon();
|
||||
|
||||
return this.tutorial();
|
||||
}
|
||||
catch (e) {
|
||||
@ -6363,6 +6365,15 @@ class LevelSite extends WordRotatorBaseSite {
|
||||
this.levelCounterActionContainer.classList.add("visible");
|
||||
}
|
||||
this.levelScaler();
|
||||
|
||||
let settingsManager = SettingsManager.getInstance();
|
||||
let soundManager = SoundManager.getInstance();
|
||||
soundManager.set({
|
||||
audio: "sound/single_coin_fall_on_concrete_.mp3",
|
||||
muted: (settingsManager.getSetting("play-sound", "1") !== "1"),
|
||||
volume: 0.7
|
||||
}, SoundManager.CHANNELS.SOUND);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -6415,7 +6426,7 @@ class LevelSite extends WordRotatorBaseSite {
|
||||
this.coinPromise = this.coinPromise.then(() => {
|
||||
return new Promise(r => {
|
||||
let timeout = 350;
|
||||
console.log("coinPromise - won", this.wonParams);
|
||||
// console.log("coinPromise - won", this.wonParams);
|
||||
if (!this.wonParams.aborted) {
|
||||
coinElem.fadeIn(timeout / 1000);
|
||||
soundManager.play(SoundManager.CHANNELS.SOUND);
|
||||
@ -6465,8 +6476,9 @@ class LevelSite extends WordRotatorBaseSite {
|
||||
|
||||
let rotatables = this.level.getRotatableSegments();
|
||||
rotatables = rotatables.filter((segment) => {
|
||||
return (segment.rotation !== 0);
|
||||
return (!segment.isSolved(false));
|
||||
});
|
||||
console.log(rotatables);
|
||||
|
||||
let index = Math.floor(Math.random() * rotatables.length);
|
||||
|
||||
|
||||
@ -36,11 +36,10 @@ export class LevelSite extends WordRotatorBaseSite {
|
||||
this.coinPromise = Promise.resolve();
|
||||
|
||||
let settingsManager = SettingsManager.getInstance();
|
||||
|
||||
let soundManager = SoundManager.getInstance();
|
||||
soundManager.set({
|
||||
audio: "sound/single_coin_fall_on_concrete_.mp3",
|
||||
muted: !settingsManager.getSetting("play-sound", true),
|
||||
muted: (settingsManager.getSetting("play-sound", "1") !== "1"),
|
||||
volume: 0.7
|
||||
}, SoundManager.CHANNELS.SOUND);
|
||||
|
||||
@ -137,6 +136,7 @@ export class LevelSite extends WordRotatorBaseSite {
|
||||
this.level = level;
|
||||
let res = this.tutorial();
|
||||
Matomo.push(["trackEvent", "LevelSite", "LoadLastLevel"]);
|
||||
this.level.checkHasWon();
|
||||
return res;
|
||||
}
|
||||
}
|
||||
@ -185,10 +185,10 @@ export class LevelSite extends WordRotatorBaseSite {
|
||||
this.wonParams.aborted = true;
|
||||
clearTimeout(this.wonParams.coinCounterTimer);
|
||||
|
||||
//LevelCounter * 2 - 1, damit der durchschnittswert stimmt
|
||||
// Matomo.push(["trackEvent", "LevelSite", "NextLevel", "Level Number Average", this.levelCounter*2-1]);
|
||||
Matomo.push(["trackEvent", "LevelSite", "NextLevel", "Level Number Normal", this.levelCounter]);
|
||||
|
||||
this.level.checkHasWon();
|
||||
|
||||
return this.tutorial();
|
||||
}
|
||||
catch (e) {
|
||||
@ -206,6 +206,15 @@ export class LevelSite extends WordRotatorBaseSite {
|
||||
this.levelCounterActionContainer.classList.add("visible");
|
||||
}
|
||||
this.levelScaler();
|
||||
|
||||
let settingsManager = SettingsManager.getInstance();
|
||||
let soundManager = SoundManager.getInstance();
|
||||
soundManager.set({
|
||||
audio: "sound/single_coin_fall_on_concrete_.mp3",
|
||||
muted: (settingsManager.getSetting("play-sound", "1") !== "1"),
|
||||
volume: 0.7
|
||||
}, SoundManager.CHANNELS.SOUND);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -258,7 +267,7 @@ export class LevelSite extends WordRotatorBaseSite {
|
||||
this.coinPromise = this.coinPromise.then(() => {
|
||||
return new Promise(r => {
|
||||
let timeout = 350;
|
||||
console.log("coinPromise - won", this.wonParams);
|
||||
// console.log("coinPromise - won", this.wonParams);
|
||||
if (!this.wonParams.aborted) {
|
||||
coinElem.fadeIn(timeout / 1000);
|
||||
soundManager.play(SoundManager.CHANNELS.SOUND);
|
||||
@ -308,8 +317,9 @@ export class LevelSite extends WordRotatorBaseSite {
|
||||
|
||||
let rotatables = this.level.getRotatableSegments();
|
||||
rotatables = rotatables.filter((segment) => {
|
||||
return (segment.rotation !== 0);
|
||||
return (!segment.isSolved(false));
|
||||
});
|
||||
console.log(rotatables);
|
||||
|
||||
let index = Math.floor(Math.random() * rotatables.length);
|
||||
|
||||
|
||||
@ -109,7 +109,7 @@ export class Level {
|
||||
if (this.rootSegment.isSolved()){
|
||||
this.hasWon = true;
|
||||
const self = this;
|
||||
delayPromise.then(()=>{
|
||||
Promise.resolve(delayPromise).then(()=>{
|
||||
self.wonResolver(true);
|
||||
});
|
||||
return true;
|
||||
|
||||
@ -171,13 +171,15 @@ export class ParentSegment extends Segment {
|
||||
return locked;
|
||||
}
|
||||
|
||||
isSolved() {
|
||||
for (let i = 0, n = this.children.length; i < n; i++) {
|
||||
if (!this.children[i].isSolved()) {
|
||||
return false;
|
||||
isSolved(checkChildren) {
|
||||
checkChildren = Helper.nonNull(checkChildren, true);
|
||||
if (checkChildren) {
|
||||
for (let i = 0, n = this.children.length; i < n; i++) {
|
||||
if (!this.children[i].isSolved()) {
|
||||
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[3]) && this.children[1].sameAs(this.children[2]) && (
|
||||
this.rotation === 180 || this.children[0].sameAs(this.children[1]))))
|
||||
|
||||
@ -10,7 +10,7 @@ use Zend\View\Model\ViewModel;
|
||||
|
||||
class IndexController extends OnlineController
|
||||
{
|
||||
const LENGTH_WORDS_MIN = 6;
|
||||
const LENGTH_WORDS_MIN = 12;
|
||||
const LENGTH_WORDS_MAX = 12;
|
||||
|
||||
const NUMBER_WORDS_TO_CHECK_SIMULTANEOUSLY = 8;
|
||||
@ -33,6 +33,7 @@ class IndexController extends OnlineController
|
||||
$wordsDeleted = $wordManager->countDeleted(self::LENGTH_WORDS_MIN, self::LENGTH_WORDS_MAX);
|
||||
$wordsChecked = $wordManager->countChecked(self::LENGTH_WORDS_MIN, self::LENGTH_WORDS_MAX);
|
||||
$wordsUnsure = $wordManager->countUnsure(self::LENGTH_WORDS_MIN, self::LENGTH_WORDS_MAX);
|
||||
$wordsNotUsed = $wordManager->countNotUsed(self::LENGTH_WORDS_MIN, self::LENGTH_WORDS_MAX);
|
||||
|
||||
$wordsToCheck = [];
|
||||
for ($i = 0; $i < self::NUMBER_WORDS_TO_CHECK_SIMULTANEOUSLY; $i++) {
|
||||
@ -45,6 +46,7 @@ class IndexController extends OnlineController
|
||||
"wordsChecked" => $wordsChecked,
|
||||
"wordsUnsure" => $wordsUnsure,
|
||||
"wordsToCheck" => $wordsToCheck,
|
||||
"wordsNotUsed" => $wordsNotUsed,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@ -134,4 +134,9 @@ class WordManager extends StandardManager
|
||||
{
|
||||
return $this->repository->findWordsForLength($length);
|
||||
}
|
||||
|
||||
public function countNotUsed($minLength = 0, $maxLength = 100)
|
||||
{
|
||||
return $this->repository->countNotUsed($minLength, $maxLength);
|
||||
}
|
||||
}
|
||||
@ -141,4 +141,20 @@ class WordRepository extends StandardRepository
|
||||
$queryBuilder->setParameter("length", $length);
|
||||
return $queryBuilder->getQuery()->getResult();
|
||||
}
|
||||
|
||||
public function countNotUsed(int $minLength, int $maxLength)
|
||||
{
|
||||
$queryBuilder = $this->_em->createQueryBuilder();
|
||||
$queryBuilder->select("COUNT(w.id)")->from(Word::class, "w");
|
||||
|
||||
$queryBuilder->andWhere($queryBuilder->expr()->eq("w.checked", "1"));
|
||||
$queryBuilder->andWhere($queryBuilder->expr()->eq("w.deleted", "0"));
|
||||
$queryBuilder->andWhere($queryBuilder->expr()->eq("w.used", "0"));
|
||||
$queryBuilder->andWhere($queryBuilder->expr()->gte($queryBuilder->expr()->length("w.word"), ":minLength"));
|
||||
$queryBuilder->andWhere($queryBuilder->expr()->lte($queryBuilder->expr()->length("w.word"), ":maxLength"));
|
||||
$queryBuilder->setParameter("minLength", $minLength);
|
||||
$queryBuilder->setParameter("maxLength", $maxLength);
|
||||
$queryBuilder->setMaxResults(1);
|
||||
return $queryBuilder->getQuery()->getSingleScalarResult();
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,7 @@
|
||||
import {Selector} from 'testcafe';
|
||||
import {ClientFunction} from 'testcafe';
|
||||
|
||||
let isLocal = false;
|
||||
|
||||
let isLocal = true;
|
||||
|
||||
const goBack = ClientFunction(() => window.history.back());
|
||||
const testLocalStorageSet = ClientFunction((key, value) => {
|
||||
@ -134,14 +133,14 @@ test('Play', async t => {
|
||||
levelNumber++;
|
||||
|
||||
//TWOLevel
|
||||
await t.expect(Selector('.segment.segment-parent.rotate-270').nth(0).textContent).eql("BOAL")
|
||||
.expect(Selector('.segment.segment-parent.rotate-180').textContent).eql("DEAR")
|
||||
.expect(Selector('.segment.segment-parent.rotate-360').textContent).eql("NSMR")
|
||||
.expect(Selector('.segment.segment-parent.rotate-270').nth(1).textContent).eql("EEUF")
|
||||
await t.expect(Selector('.segment-parent').nth(SEGMENT.ONE).textContent).eql("BRTH")
|
||||
.expect(Selector('.segment-parent').nth(SEGMENT.TWO).textContent).eql("AUER")
|
||||
.expect(Selector('.segment-parent').nth(SEGMENT.THREE).textContent).eql("ERAP")
|
||||
.expect(Selector('.segment-parent').nth(SEGMENT.FOUR).textContent).eql("EIIE")
|
||||
.expect(Selector('.segment.segment-parent.rotate-270').nth(0).getStyleProperty('transform')).eql("matrix(0, -1, 1, 0, 0, 0)")
|
||||
.expect(Selector('.segment.segment-parent.rotate-180').getStyleProperty('transform')).eql("matrix(-1, 0, 0, -1, 0, 0)")
|
||||
.expect(Selector('.segment.segment-parent.rotate-360').getStyleProperty('transform')).eql("matrix(1, 0, 0, 1, 0, 0)")
|
||||
.expect(Selector('.segment.segment-parent.rotate-270').nth(1).getStyleProperty('transform')).eql("matrix(0, -1, 1, 0, 0, 0)")
|
||||
// .expect(Selector('.segment.segment-parent.rotate-270').nth(1).getStyleProperty('transform')).eql("matrix(0, -1, 1, 0, 0, 0)")
|
||||
.expect(Selector('#continue-button').visible).eql(false)
|
||||
.expect(Selector('#level-number').textContent).eql("3")
|
||||
.expect(Selector('#won-text').visible).eql(false)
|
||||
@ -544,11 +543,11 @@ test('Sharing', async t => {
|
||||
.click(Selector(".share-icon").nth(0))
|
||||
.expect(Selector(".share-icon").nth(0).exists).eql(false)
|
||||
.expect(Selector(".share-icon").nth(1).exists).eql(false);
|
||||
if (isLocal){
|
||||
await t.expect(await getLastWindowOpened()).eql(["https://web.whatsapp.com/send?text="+encodeURIComponent("127.0.0.1/pwa/wordRotator/publicTest/"), "_blank", "noopener"]);
|
||||
if (isLocal) {
|
||||
await t.expect(await getLastWindowOpened()).eql(["https://web.whatsapp.com/send?text=" + encodeURIComponent("127.0.0.1/pwa/wordRotator/publicTest/"), "_blank", "noopener"]);
|
||||
}
|
||||
else {
|
||||
await t.expect(await getLastWindowOpened()).eql(["https://web.whatsapp.com/send?text="+encodeURIComponent("beta.wordrotator.silas.link/"), "_blank", "noopener"]);
|
||||
await t.expect(await getLastWindowOpened()).eql(["https://web.whatsapp.com/send?text=" + encodeURIComponent("beta.wordrotator.silas.link/"), "_blank", "noopener"]);
|
||||
}
|
||||
await t
|
||||
.click(Selector("#share-button"))
|
||||
@ -557,7 +556,11 @@ test('Sharing', async t => {
|
||||
.click(Selector(".share-icon").nth(1))
|
||||
.expect(Selector(".share-icon").nth(0).exists).eql(false)
|
||||
.expect(Selector(".share-icon").nth(1).exists).eql(false);
|
||||
if (isLocal){
|
||||
await t.expect(await getLastWindowOpened()).eql(["https://t.me/share/url?url="+encodeURIComponent("beta.wordrotator.silas.link/"), "_blank", "noopener"]);
|
||||
let res = await getLastWindowOpened();
|
||||
if (isLocal) {
|
||||
await t.expect(await getLastWindowOpened()).eql(["https://t.me/share/url?url=" + encodeURIComponent("127.0.0.1/pwa/wordRotator/publicTest/"), "_blank", "noopener"]);
|
||||
}
|
||||
else {
|
||||
await t.expect(await getLastWindowOpened()).eql(["https://t.me/share/url?url=" + encodeURIComponent("beta.wordrotator.silas.link/"), "_blank", "noopener"]);
|
||||
}
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user