@nakamura-123/pages 1.1.17 → 1.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/component/Basic/Badge5s.js +18 -30
- package/dist/component/Basic/BasicContents.js +38 -39
- package/dist/component/Basic/BasicProgressBar.js +16 -17
- package/dist/component/Basic/BasicSetting.js +14 -15
- package/dist/component/Basic/MiniTestCard.js +32 -33
- package/dist/component/Basic/Paw5s.js +9 -13
- package/dist/component/Basic/SelectedExamCnt.js +14 -15
- package/dist/component/Basic/SubCategoryLeft.js +5 -6
- package/dist/component/Basic/SubCategoryList.js +49 -62
- package/dist/component/Boot/SelectRange.js +18 -21
- package/dist/component/Boot/ToggleRange.js +11 -14
- package/dist/component/Coin/AppReviews.js +9 -10
- package/dist/component/Coin/CatchCopy.js +6 -6
- package/dist/component/Coin/CoinCheck.js +18 -54
- package/dist/component/Coin/CoinFnc.js +210 -282
- package/dist/component/Coin/CoinPageComponent.d.ts +1 -0
- package/dist/component/Coin/CoinPageComponent.js +22 -22
- package/dist/component/Coin/ReceiptFnc.js +3 -3
- package/dist/component/Coin/Recommend.js +10 -10
- package/dist/component/Coin/WaitingPayBanner.js +8 -9
- package/dist/component/Discription.js +6 -7
- package/dist/component/Grade/AllTags.js +12 -12
- package/dist/component/Grade/BasicBadge.js +20 -32
- package/dist/component/Grade/GradeCard/ChangeWeeklyModal.js +8 -10
- package/dist/component/Grade/GradeCard/ChangeWeeklyTargetBtn.js +21 -22
- package/dist/component/Grade/GradeCard/DatePickerModal.js +17 -19
- package/dist/component/Grade/GradeCard/GradeCard.js +19 -20
- package/dist/component/Grade/GradeCard/Square3sGrade.js +16 -17
- package/dist/component/Grade/GradeCard/TargetDate.js +19 -20
- package/dist/component/Grade/GradeCard/WeeklyAchivedRate.js +7 -8
- package/dist/component/Grade/GradeCard/WeeklyProgress.js +19 -29
- package/dist/component/Grade/JAllTags.js +16 -16
- package/dist/component/Grade/QuizCntGraph.js +31 -45
- package/dist/component/Grade/ShareBtn.js +30 -68
- package/dist/component/Grade/Square4s.js +14 -15
- package/dist/component/Grade/UnitCircles.js +18 -23
- package/dist/component/Grade/YearCircles.js +17 -22
- package/dist/component/Guide.js +6 -7
- package/dist/component/Home/OpeningMsg.js +14 -14
- package/dist/component/OnlineInput/OnlineInputFnc.js +6 -6
- package/dist/component/OnlineInput/OnlineSaveBtn.js +7 -8
- package/dist/component/OnlineInput/OnlineSavedList.js +13 -14
- package/dist/component/OnlineInput/PasswardModal.js +64 -110
- package/dist/component/OnlineInput/PasswordIdModal.js +40 -80
- package/dist/component/QuizSet/QuizOptionDrill.js +29 -42
- package/dist/component/Result/AdCard.js +21 -16
- package/dist/component/Result/CharaCard.js +15 -16
- package/dist/component/Result/LessonTitle.js +10 -10
- package/dist/component/Result/QuizFlatList.js +26 -30
- package/dist/component/Result/ScoreCircle.js +8 -9
- package/dist/component/SelectRange/SelectYearRange.js +22 -34
- package/dist/component/SettingBtns/QuizOptionSelector.js +16 -17
- package/dist/component/SettingBtns/Range.js +9 -9
- package/dist/component/SettingBtns/TransBtn.js +17 -17
- package/dist/component/TabAnimeView.js +9 -10
- package/dist/component/Tag5s.js +10 -14
- package/dist/component/TagBadge5s.js +16 -17
- package/dist/component/TagBadge5sPress.js +14 -15
- package/dist/component/TestPage/AverageBar.js +12 -24
- package/dist/component/TestPage/BarChartContainer.js +30 -31
- package/dist/component/TestPage/ChartControl.js +5 -6
- package/dist/component/TestPage/Square3s.js +12 -13
- package/dist/functions/badgeBasicFnc.js +22 -42
- package/dist/functions/badgeDailyFnc.js +24 -35
- package/dist/functions/badgeFilter.js +16 -18
- package/dist/functions/badgeFnc.js +24 -33
- package/dist/functions/createQuizFncD.js +33 -33
- package/dist/functions/createQuizFncJ.js +27 -33
- package/dist/functions/gradeFnc.js +48 -87
- package/dist/functions/oldStorageFnc.js +77 -200
- package/dist/functions/questionFilterD.js +19 -28
- package/dist/functions/questionFilterJ.js +9 -9
- package/dist/functions/questionFormatD.js +34 -47
- package/dist/functions/questionFormatJ.js +30 -41
- package/dist/functions/tagFncD.js +37 -39
- package/dist/functions/tagFncJ.js +16 -19
- package/dist/functions/testFnc.js +6 -7
- package/dist/hooks/BadgeHook.js +24 -35
- package/dist/hooks/ExitQuizHook.js +21 -21
- package/dist/hooks/basicHook.js +12 -12
- package/dist/hooks/quizActionHook.js +44 -57
- package/dist/hooks/quizHook.d.ts +2 -1
- package/dist/hooks/quizHook.js +58 -48
- package/dist/index.js +25 -25
- package/dist/page/BadgePage.js +26 -29
- package/dist/page/BasicPage.js +23 -25
- package/dist/page/BootPage.js +48 -53
- package/dist/page/CoinPage.d.ts +1 -0
- package/dist/page/CoinPage.js +90 -144
- package/dist/page/FAQPage.js +23 -23
- package/dist/page/GetBadgePage.js +35 -71
- package/dist/page/GradePage.js +26 -27
- package/dist/page/GuidePage.js +28 -33
- package/dist/page/HistoryPage.js +25 -33
- package/dist/page/HomePage.d.ts +1 -0
- package/dist/page/HomePage.js +62 -108
- package/dist/page/ImgZoom.js +8 -9
- package/dist/page/InformationPage.js +15 -15
- package/dist/page/JDetailSettingPage.js +23 -25
- package/dist/page/OnlineInputPage.js +19 -20
- package/dist/page/QuizPage.js +25 -26
- package/dist/page/QuizSettingPage.js +19 -19
- package/dist/page/QuizSetupPage.js +40 -43
- package/dist/page/ReportPage.js +55 -94
- package/dist/page/ResultPage.js +55 -103
- package/dist/page/SettingPage.js +35 -40
- package/dist/page/TestPage.js +41 -44
- package/dist/quiz/QuizContentsDrill.js +17 -18
- package/dist/quiz/QuizContentsJLPT.js +8 -9
- package/dist/quiz/Title.js +22 -22
- package/dist/quiz/answer/Answer.js +20 -20
- package/dist/quiz/answer/BlangGuide.js +10 -10
- package/dist/quiz/answer/BlankAnswer.js +11 -12
- package/dist/quiz/answer/BlankBtn.js +10 -10
- package/dist/quiz/answer/CheckButton.js +6 -9
- package/dist/quiz/answer/ChoiceView.js +15 -30
- package/dist/quiz/answer/Input/CollapseExplain.js +10 -11
- package/dist/quiz/answer/Input/InputAnswerBtn.js +9 -9
- package/dist/quiz/answer/Input/InputBox.js +17 -18
- package/dist/quiz/answer/Input/InputCounter.js +6 -7
- package/dist/quiz/answer/Input/InputFnc.js +10 -19
- package/dist/quiz/answer/Input/InputSaveSelector.js +12 -13
- package/dist/quiz/answer/Input/InputTab.js +12 -13
- package/dist/quiz/answer/Input/InputWarnning.js +13 -14
- package/dist/quiz/answer/InputGuide.js +10 -10
- package/dist/quiz/answer/InputNav.js +38 -39
- package/dist/quiz/answer/MultiChoice.js +20 -22
- package/dist/quiz/answer/MultiGuide.js +10 -10
- package/dist/quiz/answer/MultiNextBtn.js +13 -14
- package/dist/quiz/answer/NormalChoice.js +29 -42
- package/dist/quiz/answer/NormalMultiGuide.js +11 -12
- package/dist/quiz/answer/styles/getChoiceStyle.js +4 -4
- package/dist/quiz/check/Check.js +17 -18
- package/dist/quiz/check/NextQuizBtn.js +18 -19
- package/dist/quiz/check/SelectTag.js +36 -51
- package/dist/quiz/common/MyTextqqyy.js +29 -47
- package/dist/quiz/common/PageContainerWrap.js +14 -15
- package/dist/quiz/common/RenderImgOrText.js +17 -18
- package/dist/quiz/common/RubyText.js +21 -35
- package/dist/quiz/common/ZoomableImage.js +6 -9
- package/dist/quiz/explain/CorrectedBar.js +13 -14
- package/dist/quiz/explain/Explain.js +9 -10
- package/dist/quiz/explain/ExplainLogic.js +17 -23
- package/dist/quiz/explain/MovieBtn.js +10 -11
- package/dist/quiz/explain/MultiExplain.js +12 -24
- package/dist/quiz/explain/NormalExplain.js +29 -30
- package/dist/quiz/function/choiceFnc.js +2 -2
- package/dist/quiz/jAnswer/JAnswer.js +24 -26
- package/dist/quiz/jAnswer/JAnswerContents.js +12 -27
- package/dist/quiz/jQuestion/JQuestion.js +12 -13
- package/dist/quiz/jQuestion/JQuestionBottomText.js +14 -15
- package/dist/quiz/jQuestion/JQuestionText.js +13 -14
- package/dist/quiz/jQuestion/QuizCnt.js +9 -9
- package/dist/quiz/jQuestion/TimeLimit.js +23 -25
- package/dist/quiz/question/FillDiagram.js +12 -13
- package/dist/quiz/question/Question.js +25 -26
- package/dist/quiz/question/QuestionFormats.js +29 -45
- package/dist/quiz/question/QuestionReference.js +7 -7
- package/dist/quiz/question/SearchYoutue.js +10 -11
- package/dist/quiz/save/QuizSaveData.js +18 -19
- package/dist/quiz/setting/Above3BtnJ.js +25 -30
- package/dist/quiz/setting/Bottom3Btn.js +25 -30
- package/dist/quiz/setting/GuideBtn.js +19 -22
- package/dist/quiz/setting/RepeatBtn.js +27 -34
- package/dist/quiz/setting/ReturnBtn.js +8 -20
- package/dist/quiz/setting/ReturnSaveBtn.js +21 -33
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.checkDailyLogBadge = exports.checkTestBadge = exports.checkBasicBadge = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
const badgeFilter_1 = require("./badgeFilter");
|
|
5
|
+
const badgeBasicFnc_1 = require("./badgeBasicFnc");
|
|
6
|
+
const badgeDailyFnc_1 = require("./badgeDailyFnc");
|
|
7
|
+
const DEFAULT_TEST_DATA = { successCnt: 0, perfectCnt: 0 };
|
|
8
8
|
// # 1.ベーシック問題のバッジを取得
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
const checkBasicBadge = (BadgeDB, MiniDB, selected) => {
|
|
10
|
+
const { type } = selected;
|
|
11
11
|
// 01.未取得のバッジinfoを配列で取得
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
const collectedBadges = (0, badgeFilter_1.filterBasicBadge)(BadgeDB, selected);
|
|
13
|
+
const missingBadgeInfos = (0, badgeBasicFnc_1.getMissingBadgeInfos)(collectedBadges, "basic");
|
|
14
14
|
// 02.ミニテストの合格回数と満点回数を取得
|
|
15
|
-
|
|
15
|
+
const miniTestData = type === "miniTest" ? (0, badgeFilter_1.filterMiniTest)(MiniDB, selected) : DEFAULT_TEST_DATA;
|
|
16
16
|
// 03.取得条件を満たしているバッジを判定
|
|
17
|
-
|
|
17
|
+
let eligibleBadges = missingBadgeInfos.filter((info) => {
|
|
18
18
|
if (info.fnc === "first")
|
|
19
19
|
return true;
|
|
20
20
|
if (type === "miniTest")
|
|
@@ -22,52 +22,43 @@ var checkBasicBadge = function (BadgeDB, MiniDB, selected) {
|
|
|
22
22
|
return false;
|
|
23
23
|
});
|
|
24
24
|
// 04.タイトルなどの必要情報を挿入
|
|
25
|
-
eligibleBadges = eligibleBadges.map(
|
|
26
|
-
return (0, badgeBasicFnc_1.addBadgeTitleInfo)(badge, selected);
|
|
27
|
-
});
|
|
25
|
+
eligibleBadges = eligibleBadges.map((badge) => (0, badgeBasicFnc_1.addBadgeTitleInfo)(badge, selected));
|
|
28
26
|
return eligibleBadges;
|
|
29
27
|
};
|
|
30
28
|
exports.checkBasicBadge = checkBasicBadge;
|
|
31
29
|
// # 2.模擬試験のバッジを取得
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
const checkTestBadge = (BadgeDB, TestDB, selected) => {
|
|
31
|
+
const { type } = selected;
|
|
34
32
|
// 01.未取得のバッジinfoを配列で取得
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
const collectedBadges = (0, badgeFilter_1.filterBasicBadge)(BadgeDB, selected);
|
|
34
|
+
const missingBadgeInfos = (0, badgeBasicFnc_1.getMissingBadgeInfos)(collectedBadges, "test");
|
|
37
35
|
// 02.テストの合格回数と満点回数を取得
|
|
38
|
-
|
|
36
|
+
const testData = type === "test" ? (0, badgeFilter_1.filterTest)(TestDB, selected) : DEFAULT_TEST_DATA;
|
|
39
37
|
// 03.取得条件を満たしているバッジを判定
|
|
40
|
-
|
|
38
|
+
let eligibleBadges = missingBadgeInfos.filter((info) => {
|
|
41
39
|
if (info.fnc === "first")
|
|
42
40
|
return true;
|
|
43
41
|
else
|
|
44
42
|
return (0, badgeBasicFnc_1.checkTest)(testData, info.fnc);
|
|
45
43
|
});
|
|
46
44
|
// 04.タイトルなどの必要情報を挿入
|
|
47
|
-
eligibleBadges = eligibleBadges.map(
|
|
48
|
-
return (0, badgeBasicFnc_1.addBadgeTitleInfo)(badge, selected);
|
|
49
|
-
});
|
|
45
|
+
eligibleBadges = eligibleBadges.map((badge) => (0, badgeBasicFnc_1.addBadgeTitleInfo)(badge, selected));
|
|
50
46
|
return eligibleBadges;
|
|
51
47
|
};
|
|
52
48
|
exports.checkTestBadge = checkTestBadge;
|
|
53
49
|
// # 3.デイリーログのバッジを取得
|
|
54
|
-
|
|
55
|
-
if (isPast === void 0) { isPast = false; }
|
|
50
|
+
const checkDailyLogBadge = (BadgeDB, DailyLogDB, t, isPast = false) => {
|
|
56
51
|
// rd 01.未取得のバッジinfoを配列で取得
|
|
57
|
-
|
|
58
|
-
|
|
52
|
+
const collectedBadges = (0, badgeFilter_1.filterDailyLogBadge)(BadgeDB);
|
|
53
|
+
const missingBadgeInfos = (0, badgeBasicFnc_1.getMissingDailyBadgeInfos)(collectedBadges);
|
|
59
54
|
// rd 02.デイリーログの情報を取得(今日の問題数、今週の問題数、累計問題数、連続日数)
|
|
60
|
-
|
|
55
|
+
const dailyLogData = isPast
|
|
61
56
|
? (0, badgeDailyFnc_1.getBestDailyLogData)(DailyLogDB)
|
|
62
57
|
: (0, badgeDailyFnc_1.getDailyLogData)(DailyLogDB);
|
|
63
58
|
// rd 03.取得条件を満たしているバッジを判定
|
|
64
|
-
|
|
65
|
-
return (0, badgeDailyFnc_1.checkDaily)(dailyLogData, info);
|
|
66
|
-
});
|
|
59
|
+
let eligibleBadges = missingBadgeInfos.filter((info) => (0, badgeDailyFnc_1.checkDaily)(dailyLogData, info));
|
|
67
60
|
// rd 04.タイトルなどの必要情報を挿入
|
|
68
|
-
eligibleBadges = eligibleBadges.map(
|
|
69
|
-
return (0, badgeDailyFnc_1.addDailyBadgeTitleInfo)(badge, t);
|
|
70
|
-
});
|
|
61
|
+
eligibleBadges = eligibleBadges.map((badge) => (0, badgeDailyFnc_1.addDailyBadgeTitleInfo)(badge, t));
|
|
71
62
|
return eligibleBadges;
|
|
72
63
|
};
|
|
73
64
|
exports.checkDailyLogBadge = checkDailyLogBadge;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getBootQuestions = exports.getTestQuestionsByUnit = exports.getTestQuestions = exports.getMiniTestQuestions = exports.getBasicQuizList = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
const questionFilterD_1 = require("./questionFilterD");
|
|
5
|
+
const lib_1 = require("@nakamura-123/lib");
|
|
6
|
+
const questionFormatD_1 = require("./questionFormatD");
|
|
7
|
+
const getBasicQuizList = (QuestionDB, startCfg, selected) => {
|
|
8
|
+
let questions = QuestionDB.filtered("FALSEPREDICATE");
|
|
9
9
|
// 01_単元別の抽出
|
|
10
10
|
if (selected.type === "unit") {
|
|
11
|
-
|
|
11
|
+
const { category, lesson } = selected;
|
|
12
12
|
if (lesson.key === 0)
|
|
13
13
|
questions = (0, questionFilterD_1.getUnitQuestions)(QuestionDB, category);
|
|
14
14
|
else
|
|
@@ -18,8 +18,8 @@ var getBasicQuizList = function (QuestionDB, startCfg, selected) {
|
|
|
18
18
|
}
|
|
19
19
|
// 03_試験別の抽出
|
|
20
20
|
if (selected.type === "year") {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
const { category, lesson } = selected;
|
|
22
|
+
const { key } = lesson;
|
|
23
23
|
if (key === 0)
|
|
24
24
|
questions = (0, questionFilterD_1.getYearQuestions)(QuestionDB, category);
|
|
25
25
|
else
|
|
@@ -29,17 +29,17 @@ var getBasicQuizList = function (QuestionDB, startCfg, selected) {
|
|
|
29
29
|
questions = (0, questionFilterD_1.filterByTags)(questions, startCfg);
|
|
30
30
|
// 05_共通処理(シャッフル・問題数)(ここで配列化)
|
|
31
31
|
// (選択肢を変更しシャッフル)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
const { quizCnt, isShuffle } = startCfg.option;
|
|
33
|
+
const formatted = (0, questionFormatD_1.formatQuestions)(questions);
|
|
34
|
+
const filtered = (0, questionFilterD_1.commonFilter)(formatted, quizCnt, isShuffle);
|
|
35
35
|
return filtered;
|
|
36
36
|
};
|
|
37
37
|
exports.getBasicQuizList = getBasicQuizList;
|
|
38
38
|
// ミニテストの問題を取得
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
const getMiniTestQuestions = (QuestionDB, subjectType, key, cnt, outOfYearRange) => {
|
|
40
|
+
let questions = QuestionDB.filtered("FALSEPREDICATE");
|
|
41
|
+
const isOneYearMode = cnt === 901;
|
|
42
|
+
const isShuffle = isOneYearMode ? false : true;
|
|
43
43
|
if (subjectType === "unit") {
|
|
44
44
|
questions = (0, questionFilterD_1.getUnitQuestions)(QuestionDB, key);
|
|
45
45
|
questions = (0, questionFilterD_1.filterByOutOfYearRange)(questions, outOfYearRange);
|
|
@@ -48,47 +48,47 @@ var getMiniTestQuestions = function (QuestionDB, subjectType, key, cnt, outOfYea
|
|
|
48
48
|
}
|
|
49
49
|
else if (subjectType === "year")
|
|
50
50
|
questions = (0, questionFilterD_1.getYearQuestions)(QuestionDB, key);
|
|
51
|
-
|
|
51
|
+
const formatted = (0, questionFormatD_1.formatQuestions)(questions);
|
|
52
52
|
return (0, questionFilterD_1.commonFilter)(formatted, cnt, isShuffle);
|
|
53
53
|
};
|
|
54
54
|
exports.getMiniTestQuestions = getMiniTestQuestions;
|
|
55
55
|
// 模擬試験の開始(Randam)
|
|
56
|
-
|
|
56
|
+
const getTestQuestions = (QuestionDB, cnt) => {
|
|
57
57
|
// シャッフルしてから必要な数だけ抽出
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
randomItems.sort(
|
|
62
|
-
|
|
63
|
-
|
|
58
|
+
const totalCnt = QuestionDB.length;
|
|
59
|
+
const numArray = lib_1.utilFnc.createArrayBasedOnCnt(cnt, totalCnt);
|
|
60
|
+
const randomItems = Array.from(numArray).map((index) => QuestionDB[index]);
|
|
61
|
+
randomItems.sort((a, b) => a.num - b.num);
|
|
62
|
+
const formatted = (0, questionFormatD_1.formatQuestions)(randomItems);
|
|
63
|
+
const filttered = (0, questionFilterD_1.commonFilter)(formatted, cnt, false);
|
|
64
64
|
return filttered;
|
|
65
65
|
};
|
|
66
66
|
exports.getTestQuestions = getTestQuestions;
|
|
67
67
|
// 模擬試験の開始(Unit)
|
|
68
|
-
|
|
68
|
+
const getTestQuestionsByUnit = (QuestionDB, cnt, unit) => {
|
|
69
69
|
// unitに含まれる問題を抽出
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
const questions = QuestionDB.filtered("unitId IN $0", unit);
|
|
71
|
+
const formatted = (0, exports.getTestQuestions)(questions, cnt);
|
|
72
72
|
return (0, questionFilterD_1.commonFilter)(formatted, cnt, false);
|
|
73
73
|
};
|
|
74
74
|
exports.getTestQuestionsByUnit = getTestQuestionsByUnit;
|
|
75
75
|
// 集中特訓モードの開始
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
const getBootQuestions = (QuestionDB, startCfg, outOfUnitRange, outOfYearRange) => {
|
|
77
|
+
let questions = (0, questionFilterD_1.filterByOutOfYearRange)(QuestionDB, outOfYearRange);
|
|
78
78
|
questions = (0, questionFilterD_1.filterByOutOfUnitRange)(questions, outOfUnitRange);
|
|
79
79
|
questions = (0, questionFilterD_1.filterByTags)(questions, startCfg);
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
const { quizCnt, isShuffle } = startCfg.option;
|
|
81
|
+
const formatted = (0, questionFormatD_1.formatQuestions)(questions);
|
|
82
82
|
return (0, questionFilterD_1.commonFilter)(formatted, quizCnt, isShuffle);
|
|
83
83
|
};
|
|
84
84
|
exports.getBootQuestions = getBootQuestions;
|
|
85
85
|
// 特殊ミニテストモードのクイズ取得(1回分の試験だけを取得)
|
|
86
|
-
|
|
86
|
+
const getMiniTestOneYearQuestions = (questions) => {
|
|
87
87
|
var _a;
|
|
88
88
|
if (((_a = questions.isEmpty) === null || _a === void 0 ? void 0 : _a.call(questions)) || questions.length === 0)
|
|
89
89
|
return questions;
|
|
90
90
|
// ランダムに 1 問 pick → その yearId を採用(map も shuffle も不要)
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
const randomIndex = Math.floor(Math.random() * questions.length);
|
|
92
|
+
const yearId = questions[randomIndex].yearId;
|
|
93
93
|
return questions.filtered("yearId == $0", yearId);
|
|
94
94
|
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getTestQuestionsJ = exports.getMiniTestQuestionsJ = exports.getBasicQuizListJ = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
const lib_1 = require("@nakamura-123/lib");
|
|
5
|
+
const questionFilterJ_1 = require("./questionFilterJ");
|
|
6
|
+
const questionFormatJ_1 = require("./questionFormatJ");
|
|
7
|
+
const getBasicQuizListJ = (QuestionDB, startCfg, selected) => {
|
|
8
|
+
const tagName = selected.tagName || "basicTag";
|
|
9
|
+
let questions = QuestionDB.filtered("FALSEPREDICATE");
|
|
10
10
|
// 01_単元別の抽出
|
|
11
11
|
if (selected.type === "unit") {
|
|
12
|
-
|
|
12
|
+
const { category, lesson } = selected;
|
|
13
13
|
if (lesson.key === 0)
|
|
14
14
|
questions = (0, questionFilterJ_1.getUnitQuestionsJ)(QuestionDB, category);
|
|
15
15
|
else
|
|
@@ -19,44 +19,38 @@ var getBasicQuizListJ = function (QuestionDB, startCfg, selected) {
|
|
|
19
19
|
questions = (0, questionFilterJ_1.filterByTagsJ)(questions, startCfg, tagName);
|
|
20
20
|
// 05_共通処理(シャッフル・問題数)(ここで配列化)
|
|
21
21
|
// (選択肢を変更しシャッフル)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
const { quizCnt, isShuffle } = startCfg.option;
|
|
23
|
+
const formatted = (0, questionFormatJ_1.formatQuestionsJ)(questions, startCfg.option, tagName);
|
|
24
|
+
const filtered = (0, questionFilterJ_1.commonFilterJ)(formatted, quizCnt, isShuffle);
|
|
25
25
|
return filtered;
|
|
26
26
|
};
|
|
27
27
|
exports.getBasicQuizListJ = getBasicQuizListJ;
|
|
28
28
|
// ミニテストの問題を取得
|
|
29
29
|
// const testCfgOption: StartCfg['option'] = {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
var testCfgOption = createStartOption(cnt, "selectEnglish", 10);
|
|
34
|
-
var questions = QuestionDB.filtered("FALSEPREDICATE");
|
|
30
|
+
const getMiniTestQuestionsJ = (QuestionDB, key, cnt = 10, tagName = "basicTag") => {
|
|
31
|
+
const testCfgOption = createStartOption(cnt, "selectEnglish", 10);
|
|
32
|
+
let questions = QuestionDB.filtered("FALSEPREDICATE");
|
|
35
33
|
questions = (0, questionFilterJ_1.getUnitQuestionsJ)(QuestionDB, key);
|
|
36
|
-
|
|
34
|
+
const formatted = (0, questionFormatJ_1.formatQuestionsJ)(questions, testCfgOption, tagName);
|
|
37
35
|
return (0, questionFilterJ_1.commonFilterJ)(formatted, cnt, true);
|
|
38
36
|
};
|
|
39
37
|
exports.getMiniTestQuestionsJ = getMiniTestQuestionsJ;
|
|
40
38
|
// 模擬試験の開始(Randam)
|
|
41
|
-
|
|
42
|
-
if (tagName === void 0) { tagName = "basicTag"; }
|
|
39
|
+
const getTestQuestionsJ = (QuestionDB, cnt, tagName = "basicTag") => {
|
|
43
40
|
// シャッフルしてから必要な数だけ抽出
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
41
|
+
const totalCnt = QuestionDB.length;
|
|
42
|
+
const numArray = lib_1.utilFnc.createArrayBasedOnCnt(cnt, totalCnt);
|
|
43
|
+
const randomItems = Array.from(numArray).map((index) => QuestionDB[index]);
|
|
44
|
+
const formatted = (0, questionFormatJ_1.formatQuestionsJ)(randomItems, createStartOption(cnt, "selectEnglish"), tagName);
|
|
45
|
+
const filttered = (0, questionFilterJ_1.commonFilterJ)(formatted, cnt, false);
|
|
49
46
|
return filttered;
|
|
50
47
|
};
|
|
51
48
|
exports.getTestQuestionsJ = getTestQuestionsJ;
|
|
52
49
|
// startCfgの作成
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
timeLimit: timeLimit,
|
|
61
|
-
});
|
|
62
|
-
};
|
|
50
|
+
const createStartOption = (cnt, pattern, timeLimit = 10) => ({
|
|
51
|
+
tagMove: "move",
|
|
52
|
+
quizCnt: cnt,
|
|
53
|
+
isShuffle: true,
|
|
54
|
+
jlptPattern: pattern,
|
|
55
|
+
timeLimit: timeLimit,
|
|
56
|
+
});
|
|
@@ -31,81 +31,53 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
31
31
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
35
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
36
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
37
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
38
|
-
function step(op) {
|
|
39
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
40
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
41
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
42
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
43
|
-
switch (op[0]) {
|
|
44
|
-
case 0: case 1: t = op; break;
|
|
45
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
46
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
47
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
48
|
-
default:
|
|
49
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
50
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
51
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
52
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
53
|
-
if (t[2]) _.ops.pop();
|
|
54
|
-
_.trys.pop(); continue;
|
|
55
|
-
}
|
|
56
|
-
op = body.call(thisArg, _);
|
|
57
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
58
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
34
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
62
35
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
63
36
|
};
|
|
64
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
65
38
|
exports.promptStoreReview = exports.getMaxWeeklyQuizCnt = exports.getLongestConsecutiveStudyDays = exports.getConsecutiveStudyDays = exports.getTotalQuizCnt = exports.findMaxQuizCntLog = exports.getWeeklyCnts = exports.formatTodayLog = void 0;
|
|
66
|
-
|
|
67
|
-
|
|
39
|
+
const dayjs_1 = __importDefault(require("dayjs"));
|
|
40
|
+
const StoreReview = __importStar(require("expo-store-review"));
|
|
68
41
|
// # (day)指定した日の1日のログを整形して返す
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
return { quizCnt
|
|
42
|
+
const formatTodayLog = (todayLog) => {
|
|
43
|
+
const quizCnt = (todayLog === null || todayLog === void 0 ? void 0 : todayLog.quizCnt) || 0;
|
|
44
|
+
const targetCnt = (todayLog === null || todayLog === void 0 ? void 0 : todayLog.targetCnt) || 0;
|
|
45
|
+
const isAchieved = (todayLog === null || todayLog === void 0 ? void 0 : todayLog.isAchieved) || false;
|
|
46
|
+
const isNotified = (todayLog === null || todayLog === void 0 ? void 0 : todayLog.isNotified) || false;
|
|
47
|
+
return { quizCnt, targetCnt, isAchieved, isNotified };
|
|
75
48
|
};
|
|
76
49
|
exports.formatTodayLog = formatTodayLog;
|
|
77
50
|
// # 1週間の各日に、何問解いたかをweeklyDaysの日付から順に配列で返す。
|
|
78
|
-
|
|
79
|
-
return weeklyDays.map(
|
|
80
|
-
|
|
81
|
-
|
|
51
|
+
const getWeeklyCnts = (DailyLog, weeklyDays) => {
|
|
52
|
+
return weeklyDays.map((day) => {
|
|
53
|
+
const date = day.toDate();
|
|
54
|
+
const log = DailyLog.filtered("date == $0", date)[0]; // フィルタ結果の最初の要素を取得
|
|
82
55
|
return log ? log.quizCnt || 0 : 0; // 結果が存在しない場合は0を返す
|
|
83
56
|
});
|
|
84
57
|
};
|
|
85
58
|
exports.getWeeklyCnts = getWeeklyCnts;
|
|
86
59
|
// # 1日の最大問題数を持つログを取得
|
|
87
|
-
|
|
60
|
+
const findMaxQuizCntLog = (DailyDB) => {
|
|
88
61
|
// すべてのレコードを取得
|
|
89
|
-
|
|
62
|
+
const allLogs = DailyDB.sorted("quizCnt", true); // quizCntで降順にソート
|
|
90
63
|
return allLogs.length > 0 ? allLogs[0] : null; // 最初のレコードが最大値を持つ
|
|
91
64
|
};
|
|
92
65
|
exports.findMaxQuizCntLog = findMaxQuizCntLog;
|
|
93
66
|
// # 全期間の問題数の通算を算出する
|
|
94
|
-
|
|
95
|
-
return DailyLogDB.reduce(
|
|
67
|
+
const getTotalQuizCnt = (DailyLogDB) => {
|
|
68
|
+
return DailyLogDB.reduce((total, log) => total + (log.quizCnt || 0), 0);
|
|
96
69
|
};
|
|
97
70
|
exports.getTotalQuizCnt = getTotalQuizCnt;
|
|
98
71
|
//
|
|
99
72
|
// # 連続学習日数を取得
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
for (
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
var logCnt = log.quizCnt || 0;
|
|
73
|
+
const getConsecutiveStudyDays = (DailyLogDB) => {
|
|
74
|
+
const today = (0, dayjs_1.default)(); // 現在の日付を取得
|
|
75
|
+
const dailyLogs = DailyLogDB.sorted("date", true); // 日付で降順にソート
|
|
76
|
+
let consecutiveDays = 0;
|
|
77
|
+
let currentDate = today;
|
|
78
|
+
for (const log of dailyLogs) {
|
|
79
|
+
const logDate = (0, dayjs_1.default)(log.date); // dayjs オブジェクトとして処理
|
|
80
|
+
const logCnt = log.quizCnt || 0;
|
|
109
81
|
// 現在の日付とログの日付を比較し、logCnt > 0 の場合にのみ連続と認識
|
|
110
82
|
if (logDate.isSame(currentDate, "day") && logCnt > 0) {
|
|
111
83
|
consecutiveDays++; // 連続日数をインクリメント
|
|
@@ -118,15 +90,15 @@ var getConsecutiveStudyDays = function (DailyLogDB) {
|
|
|
118
90
|
return consecutiveDays;
|
|
119
91
|
};
|
|
120
92
|
exports.getConsecutiveStudyDays = getConsecutiveStudyDays;
|
|
121
|
-
|
|
122
|
-
|
|
93
|
+
const getLongestConsecutiveStudyDays = (DailyLogDB) => {
|
|
94
|
+
const dailyLogs = DailyLogDB.sorted("date", true); // 日付で降順にソート
|
|
123
95
|
if (dailyLogs.length === 0)
|
|
124
96
|
return 0; // ログがない場合は 0 を返す
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
for (
|
|
128
|
-
|
|
129
|
-
|
|
97
|
+
let longestStreak = 0;
|
|
98
|
+
let currentStreak = 1;
|
|
99
|
+
for (let i = 1; i < dailyLogs.length; i++) {
|
|
100
|
+
const currentDate = (0, dayjs_1.default)(dailyLogs[i].date);
|
|
101
|
+
const previousDate = (0, dayjs_1.default)(dailyLogs[i - 1].date);
|
|
130
102
|
// 日付が連続しているか判定
|
|
131
103
|
if (currentDate.isSame(previousDate.subtract(1, "day"), "day")) {
|
|
132
104
|
currentStreak++; // 連続日数をインクリメント
|
|
@@ -142,17 +114,16 @@ var getLongestConsecutiveStudyDays = function (DailyLogDB) {
|
|
|
142
114
|
};
|
|
143
115
|
exports.getLongestConsecutiveStudyDays = getLongestConsecutiveStudyDays;
|
|
144
116
|
// # 指定した週数分の各週の合計問題数の最大値を返す
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
var weekEnd = today.subtract(i, "week").endOf("week").add(1, "day");
|
|
117
|
+
const getMaxWeeklyQuizCnt = (DailyLogDB, weeks = 20) => {
|
|
118
|
+
const today = (0, dayjs_1.default)();
|
|
119
|
+
let maxCnt = 0;
|
|
120
|
+
for (let i = 0; i < weeks; i++) {
|
|
121
|
+
const weekStart = today.subtract(i, "week").startOf("week").add(1, "day");
|
|
122
|
+
const weekEnd = today.subtract(i, "week").endOf("week").add(1, "day");
|
|
152
123
|
// その週のログを抽出
|
|
153
|
-
|
|
124
|
+
const weekLogs = DailyLogDB.filtered("date >= $0 && date <= $1", weekStart.toDate(), weekEnd.toDate());
|
|
154
125
|
// その週のquizCnt合計
|
|
155
|
-
|
|
126
|
+
const weekCnt = weekLogs.reduce((sum, log) => sum + (log.quizCnt || 0), 0);
|
|
156
127
|
if (weekCnt > maxCnt) {
|
|
157
128
|
maxCnt = weekCnt;
|
|
158
129
|
}
|
|
@@ -160,23 +131,13 @@ var getMaxWeeklyQuizCnt = function (DailyLogDB, weeks) {
|
|
|
160
131
|
return maxCnt;
|
|
161
132
|
};
|
|
162
133
|
exports.getMaxWeeklyQuizCnt = getMaxWeeklyQuizCnt;
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
case 2:
|
|
173
|
-
_a.sent();
|
|
174
|
-
return [3 /*break*/, 4];
|
|
175
|
-
case 3:
|
|
176
|
-
console.log("Store review is not available on this device.");
|
|
177
|
-
_a.label = 4;
|
|
178
|
-
case 4: return [2 /*return*/];
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
}); };
|
|
134
|
+
const promptStoreReview = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
135
|
+
const isAvailable = yield StoreReview.isAvailableAsync();
|
|
136
|
+
if (isAvailable) {
|
|
137
|
+
yield StoreReview.requestReview();
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
console.log("Store review is not available on this device.");
|
|
141
|
+
}
|
|
142
|
+
});
|
|
182
143
|
exports.promptStoreReview = promptStoreReview;
|