diff --git a/app/ecolyo.d76e89665f643bc7f19c.js b/app/ecolyo.9dd9c82dca1ad99a8c8b.js similarity index 99% rename from app/ecolyo.d76e89665f643bc7f19c.js rename to app/ecolyo.9dd9c82dca1ad99a8c8b.js index 2a8b243d7507f40d895d0b5cf45caa59c5d99edc..40e7fd2d53feb90979bb777c2bae8a8e32ec1064 100644 --- a/app/ecolyo.d76e89665f643bc7f19c.js +++ b/app/ecolyo.9dd9c82dca1ad99a8c8b.js @@ -7090,7 +7090,7 @@ var QuizService = /*#__PURE__*/function () { key: "updateUserQuiz", value: function () { var _updateUserQuiz = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(userQuiz, questionResult, questionIndex) { - var updatedQuestion, _updatedQuestion, updatedUserQuiz; + var updatedQuestion, _updatedQuestion, quizScoreLimit, updatedUserQuiz; return _regenerator.default.wrap(function _callee7$(_context7) { while (1) { @@ -7108,12 +7108,14 @@ var QuizService = /*#__PURE__*/function () { userQuiz.customQuestion = _updatedQuestion; } + quizScoreLimit = userQuiz.result; + quizScoreLimit = quizScoreLimit + 1 > 5 ? 5 : quizScoreLimit + 1; updatedUserQuiz = (0, _objectSpread2.default)({}, userQuiz, { - result: questionResult ? userQuiz.result + 1 : userQuiz.result + result: questionResult ? quizScoreLimit : userQuiz.result }); return _context7.abrupt("return", updatedUserQuiz); - case 3: + case 5: case "end": return _context7.stop(); } @@ -23216,12 +23218,12 @@ var ChallengeService = /*#__PURE__*/function () { explorationService = new _exploration.default(this._client); actionService = new _action.default(this._client); _context12.t0 = flag; - _context12.next = _context12.t0 === _userChallenge2.UserChallengeUpdateFlag.CHALLENGE ? 11 : _context12.t0 === _userChallenge2.UserChallengeUpdateFlag.DUEL_CONSUMPTION ? 11 : _context12.t0 === _userChallenge2.UserChallengeUpdateFlag.DUEL_UNLOCK ? 13 : _context12.t0 === _userChallenge2.UserChallengeUpdateFlag.DUEL_UPDATE_THRESHOLD ? 18 : _context12.t0 === _userChallenge2.UserChallengeUpdateFlag.DUEL_START ? 23 : _context12.t0 === _userChallenge2.UserChallengeUpdateFlag.DUEL_WIN ? 28 : _context12.t0 === _userChallenge2.UserChallengeUpdateFlag.DUEL_LOSS ? 33 : _context12.t0 === _userChallenge2.UserChallengeUpdateFlag.QUIZ_START ? 38 : _context12.t0 === _userChallenge2.UserChallengeUpdateFlag.QUIZ_DONE ? 43 : _context12.t0 === _userChallenge2.UserChallengeUpdateFlag.QUIZ_UPDATE ? 49 : _context12.t0 === _userChallenge2.UserChallengeUpdateFlag.QUIZ_RESET ? 51 : _context12.t0 === _userChallenge2.UserChallengeUpdateFlag.EXPLORATION_START ? 56 : _context12.t0 === _userChallenge2.UserChallengeUpdateFlag.EXPLORATION_UPDATE ? 61 : _context12.t0 === _userChallenge2.UserChallengeUpdateFlag.EXPLORATION_NOTIFICATION ? 66 : _context12.t0 === _userChallenge2.UserChallengeUpdateFlag.EXPLORATION_DONE ? 71 : _context12.t0 === _userChallenge2.UserChallengeUpdateFlag.ACTION_START ? 74 : _context12.t0 === _userChallenge2.UserChallengeUpdateFlag.ACTION_NOTIFICATION ? 78 : _context12.t0 === _userChallenge2.UserChallengeUpdateFlag.ACTION_DONE ? 81 : 84; + _context12.next = _context12.t0 === _userChallenge2.UserChallengeUpdateFlag.CHALLENGE ? 11 : _context12.t0 === _userChallenge2.UserChallengeUpdateFlag.DUEL_CONSUMPTION ? 11 : _context12.t0 === _userChallenge2.UserChallengeUpdateFlag.DUEL_UNLOCK ? 13 : _context12.t0 === _userChallenge2.UserChallengeUpdateFlag.DUEL_UPDATE_THRESHOLD ? 18 : _context12.t0 === _userChallenge2.UserChallengeUpdateFlag.DUEL_START ? 23 : _context12.t0 === _userChallenge2.UserChallengeUpdateFlag.DUEL_WIN ? 28 : _context12.t0 === _userChallenge2.UserChallengeUpdateFlag.DUEL_LOSS ? 33 : _context12.t0 === _userChallenge2.UserChallengeUpdateFlag.QUIZ_START ? 38 : _context12.t0 === _userChallenge2.UserChallengeUpdateFlag.QUIZ_DONE ? 43 : _context12.t0 === _userChallenge2.UserChallengeUpdateFlag.QUIZ_UPDATE ? 50 : _context12.t0 === _userChallenge2.UserChallengeUpdateFlag.QUIZ_RESET ? 52 : _context12.t0 === _userChallenge2.UserChallengeUpdateFlag.EXPLORATION_START ? 57 : _context12.t0 === _userChallenge2.UserChallengeUpdateFlag.EXPLORATION_UPDATE ? 62 : _context12.t0 === _userChallenge2.UserChallengeUpdateFlag.EXPLORATION_NOTIFICATION ? 67 : _context12.t0 === _userChallenge2.UserChallengeUpdateFlag.EXPLORATION_DONE ? 72 : _context12.t0 === _userChallenge2.UserChallengeUpdateFlag.ACTION_START ? 75 : _context12.t0 === _userChallenge2.UserChallengeUpdateFlag.ACTION_NOTIFICATION ? 79 : _context12.t0 === _userChallenge2.UserChallengeUpdateFlag.ACTION_DONE ? 82 : 85; break; case 11: updatedUserChallenge = userChallenge; - return _context12.abrupt("break", 86); + return _context12.abrupt("break", 87); case 13: _context12.next = 15; @@ -23233,7 +23235,7 @@ var ChallengeService = /*#__PURE__*/function () { state: _userChallenge2.UserChallengeState.DUEL, duel: updatedDuel }); - return _context12.abrupt("break", 86); + return _context12.abrupt("break", 87); case 18: _context12.next = 20; @@ -23245,7 +23247,7 @@ var ChallengeService = /*#__PURE__*/function () { state: _userChallenge2.UserChallengeState.DUEL, duel: updatedDuel }); - return _context12.abrupt("break", 86); + return _context12.abrupt("break", 87); case 23: _context12.next = 25; @@ -23257,7 +23259,7 @@ var ChallengeService = /*#__PURE__*/function () { state: _userChallenge2.UserChallengeState.DUEL, duel: updatedDuel }); - return _context12.abrupt("break", 86); + return _context12.abrupt("break", 87); case 28: _context12.next = 30; @@ -23273,7 +23275,7 @@ var ChallengeService = /*#__PURE__*/function () { }).startOf('day'), success: _userChallenge2.UserChallengeSuccess.WIN }); - return _context12.abrupt("break", 86); + return _context12.abrupt("break", 87); case 33: _context12.next = 35; @@ -23289,7 +23291,7 @@ var ChallengeService = /*#__PURE__*/function () { }).startOf('day'), success: _userChallenge2.UserChallengeSuccess.LOST }); - return _context12.abrupt("break", 86); + return _context12.abrupt("break", 87); case 38: _context12.next = 40; @@ -23300,74 +23302,78 @@ var ChallengeService = /*#__PURE__*/function () { updatedUserChallenge = (0, _objectSpread2.default)({}, userChallenge, { quiz: updatedQuiz }); - return _context12.abrupt("break", 86); + return _context12.abrupt("break", 87); case 43: if (userChallenge.quiz.result > userChallenge.progress.quizProgress) { userChallenge.progress.quizProgress = userChallenge.quiz.result; } - _context12.next = 46; + if (userChallenge.progress.quizProgress > 5) { + userChallenge.progress.quizProgress = 5; + } + + _context12.next = 47; return quizService.endUserQuiz(userChallenge.quiz); - case 46: + case 47: updatedQuiz = _context12.sent; updatedUserChallenge = (0, _objectSpread2.default)({}, userChallenge, { quiz: updatedQuiz }); - return _context12.abrupt("break", 86); + return _context12.abrupt("break", 87); - case 49: + case 50: updatedUserChallenge = (0, _objectSpread2.default)({}, userChallenge, { quiz: quizWithUpdatedQuestions ? quizWithUpdatedQuestions : userChallenge.quiz }); - return _context12.abrupt("break", 86); + return _context12.abrupt("break", 87); - case 51: - _context12.next = 53; + case 52: + _context12.next = 54; return quizService.resetUserQuiz(userChallenge.quiz); - case 53: + case 54: updatedQuiz = _context12.sent; updatedUserChallenge = (0, _objectSpread2.default)({}, userChallenge, { quiz: updatedQuiz }); - return _context12.abrupt("break", 86); + return _context12.abrupt("break", 87); - case 56: - _context12.next = 58; + case 57: + _context12.next = 59; return explorationService.startUserExploration(userChallenge.exploration); - case 58: + case 59: updatedExploration = _context12.sent; updatedUserChallenge = (0, _objectSpread2.default)({}, userChallenge, { exploration: updatedExploration }); - return _context12.abrupt("break", 86); + return _context12.abrupt("break", 87); - case 61: - _context12.next = 63; + case 62: + _context12.next = 64; return explorationService.updateUserExploration(userChallenge.exploration); - case 63: + case 64: updatedExploration = _context12.sent; updatedUserChallenge = (0, _objectSpread2.default)({}, userChallenge, { exploration: updatedExploration }); - return _context12.abrupt("break", 86); + return _context12.abrupt("break", 87); - case 66: - _context12.next = 68; + case 67: + _context12.next = 69; return explorationService.awaitNotificationUserExploration(userChallenge.exploration); - case 68: + case 69: updatedExploration = _context12.sent; updatedUserChallenge = (0, _objectSpread2.default)({}, userChallenge, { exploration: updatedExploration }); - return _context12.abrupt("break", 86); + return _context12.abrupt("break", 87); - case 71: + case 72: updatedExploration = explorationService.endUserExploration(userChallenge.exploration); updatedUserChallenge = (0, _objectSpread2.default)({}, userChallenge, { exploration: updatedExploration, @@ -23375,9 +23381,9 @@ var ChallengeService = /*#__PURE__*/function () { explorationProgress: updatedExploration.progress }) }); - return _context12.abrupt("break", 86); + return _context12.abrupt("break", 87); - case 74: + case 75: userAction = userChallenge.action; if (action) { @@ -23387,16 +23393,16 @@ var ChallengeService = /*#__PURE__*/function () { updatedUserChallenge = (0, _objectSpread2.default)({}, userChallenge, { action: userAction }); - return _context12.abrupt("break", 86); + return _context12.abrupt("break", 87); - case 78: + case 79: updatedAction = actionService.awaitNotificationAction(userChallenge.action); updatedUserChallenge = (0, _objectSpread2.default)({}, userChallenge, { action: updatedAction }); - return _context12.abrupt("break", 86); + return _context12.abrupt("break", 87); - case 81: + case 82: updatedAction = actionService.endAction(userChallenge.action); updatedUserChallenge = (0, _objectSpread2.default)({}, userChallenge, { action: updatedAction, @@ -23404,35 +23410,35 @@ var ChallengeService = /*#__PURE__*/function () { actionProgress: 5 }) }); - return _context12.abrupt("break", 86); + return _context12.abrupt("break", 87); - case 84: + case 85: updatedUserChallenge = userChallenge; - return _context12.abrupt("break", 86); + return _context12.abrupt("break", 87); - case 86: - _context12.prev = 86; - _context12.next = 89; + case 87: + _context12.prev = 87; + _context12.next = 90; return this._client.save(updatedUserChallenge); - case 89: + case 90: _yield$this$_client$s = _context12.sent; userChallengeEntity = _yield$this$_client$s.data; result = this.parseUserChallengeEntityToUserChallenge(userChallengeEntity); return _context12.abrupt("return", result); - case 95: - _context12.prev = 95; - _context12.t1 = _context12["catch"](86); + case 96: + _context12.prev = 96; + _context12.t1 = _context12["catch"](87); console.log('Update user challenge error : ', _context12.t1); throw _context12.t1; - case 99: + case 100: case "end": return _context12.stop(); } } - }, _callee11, this, [[86, 95]]); + }, _callee11, this, [[87, 96]]); })); function updateUserChallenge(_x21, _x22, _x23, _x24, _x25) { diff --git a/index.html b/index.html index 0ccbddc03316c67f2ba0166eedc1f8105d9b03c3..8fdfc6af69fb6888ef5b5beb3a189591791c0c36 100644 --- a/index.html +++ b/index.html @@ -1 +1 @@ -<!DOCTYPE html><html lang="{{.Locale}}"><head><meta charset="utf-8"><title>Ecolyo</title><link rel="icon" type="image/png" href="/favicon-32x32.png" sizes="32x32"><link rel="icon" type="image/png" href="/favicon-16x16.png" sizes="16x16"><!-- PWA Manifest --><link rel="manifest" href="/manifest.json" crossorigin="use-credentials"><link rel="mask-icon" href="/safari-pinned-tab.svg" color="#297EF2"><meta name="theme-color" content="#ffffff"><!-- PWA Chrome --><link rel="icon" sizes="192x192" href="/android-chrome-192x192.png"><link rel="icon" sizes="512x512" href="/android-chrome-512x512.png"><!-- PWA iOS --><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"><link rel="apple-touch-startup-image" href="/apple-touch-icon.png"><meta name="apple-mobile-web-app-title" content="Ecolyo"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="viewport" content="width=device-width,height=device-height,initial-scale=1,viewport-fit=cover">{{.ThemeCSS}} {{.CozyBar}}</head><body><div role="application" class="application" data-cozy-token="{{.Token}}" data-cozy-domain="{{.Domain}}" data-cozy-locale="{{.Locale}}" data-cozy-app-name="{{.AppName}}" data-cozy-app-slug="{{.AppSlug}}" data-cozy-app-name-prefix="{{.AppNamePrefix}}" data-cozy-app-editor="{{.AppEditor}}" data-cozy-icon-path="{{.IconPath}}"><script src="vendors/ecolyo.7ec2f99d334bc5028d00.js"></script><script src="app/ecolyo.d76e89665f643bc7f19c.js"></script></div></body></html> \ No newline at end of file +<!DOCTYPE html><html lang="{{.Locale}}"><head><meta charset="utf-8"><title>Ecolyo</title><link rel="icon" type="image/png" href="/favicon-32x32.png" sizes="32x32"><link rel="icon" type="image/png" href="/favicon-16x16.png" sizes="16x16"><!-- PWA Manifest --><link rel="manifest" href="/manifest.json" crossorigin="use-credentials"><link rel="mask-icon" href="/safari-pinned-tab.svg" color="#297EF2"><meta name="theme-color" content="#ffffff"><!-- PWA Chrome --><link rel="icon" sizes="192x192" href="/android-chrome-192x192.png"><link rel="icon" sizes="512x512" href="/android-chrome-512x512.png"><!-- PWA iOS --><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"><link rel="apple-touch-startup-image" href="/apple-touch-icon.png"><meta name="apple-mobile-web-app-title" content="Ecolyo"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="viewport" content="width=device-width,height=device-height,initial-scale=1,viewport-fit=cover">{{.ThemeCSS}} {{.CozyBar}}</head><body><div role="application" class="application" data-cozy-token="{{.Token}}" data-cozy-domain="{{.Domain}}" data-cozy-locale="{{.Locale}}" data-cozy-app-name="{{.AppName}}" data-cozy-app-slug="{{.AppSlug}}" data-cozy-app-name-prefix="{{.AppNamePrefix}}" data-cozy-app-editor="{{.AppEditor}}" data-cozy-icon-path="{{.IconPath}}"><script src="vendors/ecolyo.7ec2f99d334bc5028d00.js"></script><script src="app/ecolyo.9dd9c82dca1ad99a8c8b.js"></script></div></body></html> \ No newline at end of file diff --git a/services/aggregatorUsageEvents/ecolyo.js b/services/aggregatorUsageEvents/ecolyo.js index 5e421bfd0cc6b19cc5884b1764fc921a2fa66941..013801d1ebab70f2fdb99ec69b60d7fa58ee693e 100644 --- a/services/aggregatorUsageEvents/ecolyo.js +++ b/services/aggregatorUsageEvents/ecolyo.js @@ -85351,6 +85351,10 @@ class ChallengeService { userChallenge.progress.quizProgress = userChallenge.quiz.result; } + if (userChallenge.progress.quizProgress > 5) { + userChallenge.progress.quizProgress = 5; + } + updatedQuiz = await quizService.endUserQuiz(userChallenge.quiz); updatedUserChallenge = (0, _objectSpread2.default)({}, userChallenge, { quiz: updatedQuiz @@ -86413,8 +86417,10 @@ class QuizService { userQuiz.customQuestion = updatedQuestion; } + let quizScoreLimit = userQuiz.result; + quizScoreLimit = quizScoreLimit + 1 > 5 ? 5 : quizScoreLimit + 1; const updatedUserQuiz = (0, _objectSpread2.default)({}, userQuiz, { - result: questionResult ? userQuiz.result + 1 : userQuiz.result + result: questionResult ? quizScoreLimit : userQuiz.result }); return updatedUserQuiz; }