@nakamura-123/pages 0.1.21 → 0.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.
Files changed (128) hide show
  1. package/dist/component/Basic/BasicContents.js +3 -1
  2. package/dist/component/Basic/MiniTestCard.js +11 -3
  3. package/dist/component/Basic/SelectedExamCnt.js +3 -0
  4. package/dist/component/Basic/SubCategoryList.d.ts +1 -1
  5. package/dist/component/Basic/SubCategoryList.js +28 -19
  6. package/dist/component/Grade/AllTags.d.ts +2 -2
  7. package/dist/component/Grade/AllTags.js +2 -2
  8. package/dist/component/Grade/JAllTags.d.ts +5 -0
  9. package/dist/component/Grade/JAllTags.js +45 -0
  10. package/dist/component/QuizSet/QuizOptionDrill.d.ts +2 -2
  11. package/dist/component/QuizSet/QuizOptionDrill.js +9 -5
  12. package/dist/component/Result/QuizFlatList.js +20 -7
  13. package/dist/component/SettingBtns/TransBtn.d.ts +4 -0
  14. package/dist/component/SettingBtns/TransBtn.js +119 -0
  15. package/dist/component/SubCagegoryList.js +182 -95
  16. package/dist/component/Tag5s.js +2 -2
  17. package/dist/component/TagBadge5s.js +14 -33
  18. package/dist/component/TagBadge5sPress.js +2 -2
  19. package/dist/functions/commonFilter.d.ts +0 -0
  20. package/dist/functions/commonFilter.js +12 -0
  21. package/dist/functions/createQuizFnc.d.ts +6 -13
  22. package/dist/functions/createQuizFnc.js +18 -18
  23. package/dist/functions/createQuizFncD.d.ts +18 -0
  24. package/dist/functions/createQuizFncD.js +80 -0
  25. package/dist/functions/createQuizFncJ.d.ts +9 -0
  26. package/dist/functions/createQuizFncJ.js +63 -0
  27. package/dist/functions/gradeFnc.js +1 -1
  28. package/dist/functions/questionFilter.d.ts +1 -3
  29. package/dist/functions/questionFilterD.d.ts +14 -0
  30. package/dist/functions/questionFilterD.js +79 -0
  31. package/dist/functions/questionFilterJ.d.ts +10 -0
  32. package/dist/functions/questionFilterJ.js +36 -0
  33. package/dist/functions/questionFilterJLPT.d.ts +5 -0
  34. package/dist/functions/questionFilterJLPT.js +17 -0
  35. package/dist/functions/questionFormat copy.d.ts +7 -0
  36. package/dist/functions/questionFormat copy.js +103 -0
  37. package/dist/functions/questionFormat.d.ts +2 -2
  38. package/dist/functions/questionFormatD.d.ts +7 -0
  39. package/dist/functions/questionFormatD.js +104 -0
  40. package/dist/functions/questionFormatJ.d.ts +8 -0
  41. package/dist/functions/questionFormatJ.js +95 -0
  42. package/dist/functions/tagFnc.js +14 -14
  43. package/dist/functions/tagFncD.d.ts +18 -0
  44. package/dist/functions/tagFncD.js +114 -0
  45. package/dist/functions/tagFncJ.d.ts +7 -0
  46. package/dist/functions/tagFncJ.js +44 -0
  47. package/dist/functions/tagFncJLPT.d.ts +5 -0
  48. package/dist/functions/tagFncJLPT.js +18 -0
  49. package/dist/hooks/basicHook.d.ts +3 -0
  50. package/dist/hooks/basicHook.js +20 -1
  51. package/dist/hooks/quizActionHook.d.ts +3 -3
  52. package/dist/hooks/quizActionHook.js +22 -5
  53. package/dist/hooks/quizHook.d.ts +9 -2
  54. package/dist/hooks/quizHook.js +51 -5
  55. package/dist/index.d.ts +4 -1
  56. package/dist/index.js +7 -1
  57. package/dist/page/BootPage.js +6 -6
  58. package/dist/page/DatailSettingPage.d.ts +3 -0
  59. package/dist/page/DatailSettingPage.js +25 -0
  60. package/dist/page/GetBadgePage.js +1 -1
  61. package/dist/page/GradePage.js +5 -2
  62. package/dist/page/GuidePage.d.ts +10 -0
  63. package/dist/page/GuidePage.js +112 -0
  64. package/dist/page/JDatailSettingPage.d.ts +3 -0
  65. package/dist/page/JDatailSettingPage.js +25 -0
  66. package/dist/page/JDetailSettingPage.d.ts +3 -0
  67. package/dist/page/JDetailSettingPage.js +51 -0
  68. package/dist/page/QuizPage.js +15 -69
  69. package/dist/page/QuizSetupPage.js +20 -8
  70. package/dist/page/ReportPage.js +1 -1
  71. package/dist/page/TestPage.js +15 -5
  72. package/dist/quiz/QuizContentDrill.d.ts +15 -0
  73. package/dist/quiz/QuizContentDrill.js +34 -0
  74. package/dist/quiz/QuizContentsDrill.d.ts +16 -0
  75. package/dist/quiz/QuizContentsDrill.js +70 -0
  76. package/dist/quiz/QuizContentsJLPT.d.ts +16 -0
  77. package/dist/quiz/QuizContentsJLPT.js +31 -0
  78. package/dist/quiz/Title.js +3 -1
  79. package/dist/quiz/answer/Answer.js +7 -6
  80. package/dist/quiz/answer/BlankBtn.js +7 -2
  81. package/dist/quiz/answer/Input/InputAnswerBtn.js +1 -1
  82. package/dist/quiz/answer/MultiChoice.js +2 -0
  83. package/dist/quiz/answer/NormalChoice.js +1 -1
  84. package/dist/quiz/check/NextQuizBtn.js +1 -0
  85. package/dist/quiz/check/SelectTag.js +21 -5
  86. package/dist/quiz/common/MyTextqqyy.js +1 -2
  87. package/dist/quiz/common/PageContainerWrap.d.ts +1 -1
  88. package/dist/quiz/common/RenderImgOrText.d.ts +4 -4
  89. package/dist/quiz/common/RenderImgOrText.js +7 -3
  90. package/dist/quiz/common/RubyText.d.ts +6 -1
  91. package/dist/quiz/common/RubyText.js +58 -39
  92. package/dist/quiz/common/ZoomableImage.d.ts +1 -0
  93. package/dist/quiz/common/ZoomableImage.js +2 -2
  94. package/dist/quiz/explain/Explain.js +4 -2
  95. package/dist/quiz/jAnswer/JAnswer.d.ts +8 -0
  96. package/dist/quiz/jAnswer/JAnswer.js +57 -0
  97. package/dist/quiz/jAnswer/JAnswerContents.d.ts +16 -0
  98. package/dist/quiz/jAnswer/JAnswerContents.js +82 -0
  99. package/dist/quiz/jQuestion/JQuestion.d.ts +8 -0
  100. package/dist/quiz/jQuestion/JQuestion.js +41 -0
  101. package/dist/quiz/jQuestion/JQuestionBottomText.d.ts +7 -0
  102. package/dist/quiz/jQuestion/JQuestionBottomText.js +46 -0
  103. package/dist/quiz/jQuestion/JQuestionText.d.ts +7 -0
  104. package/dist/quiz/jQuestion/JQuestionText.js +43 -0
  105. package/dist/quiz/jQuestion/QuizCnt.d.ts +3 -0
  106. package/dist/quiz/jQuestion/QuizCnt.js +44 -0
  107. package/dist/quiz/jQuestion/TimeLimit.d.ts +6 -0
  108. package/dist/quiz/jQuestion/TimeLimit.js +97 -0
  109. package/dist/quiz/question/Question.js +3 -1
  110. package/dist/quiz/setting/Above3BtnJ copy.d.ts +8 -0
  111. package/dist/quiz/setting/Above3BtnJ copy.js +78 -0
  112. package/dist/quiz/setting/Above3BtnJ.d.ts +8 -0
  113. package/dist/quiz/setting/Above3BtnJ.js +56 -0
  114. package/dist/quiz/setting/Bottom2BtnJ.d.ts +8 -0
  115. package/dist/quiz/setting/Bottom2BtnJ.js +86 -0
  116. package/dist/quiz/setting/Bottom3Btn.js +1 -23
  117. package/dist/quiz/setting/Bottom3BtnJ.d.ts +8 -0
  118. package/dist/quiz/setting/Bottom3BtnJ.js +78 -0
  119. package/dist/quiz/setting/GuideBtn.d.ts +8 -0
  120. package/dist/quiz/setting/GuideBtn.js +38 -0
  121. package/dist/quiz/setting/RepeatBtn.d.ts +6 -0
  122. package/dist/quiz/setting/RepeatBtn.js +77 -0
  123. package/dist/quiz/system/QuizContentDrill.d.ts +0 -0
  124. package/dist/quiz/system/QuizContentDrill.js +1 -0
  125. package/dist/tsconfig.tsbuildinfo +1 -1
  126. package/dist/types/filterType.d.ts +15 -0
  127. package/dist/types/filterType.js +2 -0
  128. package/package.json +2 -2
@@ -0,0 +1,9 @@
1
+ import { CfgInitial, QuizInitial } from "@nakamura-123/stores";
2
+ import { Db, JStore } from "@nakamura-123/types";
3
+ import { QRJ } from "../types/filterType";
4
+ type StartCfg = CfgInitial["startCfg"];
5
+ type Selected = QuizInitial["selected"];
6
+ export declare const getBasicQuizListJ: (QuestionDB: QRJ, startCfg: StartCfg, selected: Selected) => JStore.JQInStore[];
7
+ export declare const getMiniTestQuestionsJ: (QuestionDB: QRJ, key: number, cnt?: number, tagName?: Db.SubjectTag) => JStore.JQInStore[];
8
+ export declare const getTestQuestionsJ: (QuestionDB: QRJ, cnt: number, tagName?: Db.SubjectTag) => JStore.JQInStore[];
9
+ export {};
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getTestQuestionsJ = exports.getMiniTestQuestionsJ = exports.getBasicQuizListJ = void 0;
4
+ var lib_1 = require("@nakamura-123/lib");
5
+ var questionFilterJ_1 = require("./questionFilterJ");
6
+ var questionFormatJ_1 = require("./questionFormatJ");
7
+ var getBasicQuizListJ = function (QuestionDB, startCfg, selected) {
8
+ var tagName = selected.tagName || "basicTag";
9
+ var questions = QuestionDB.filtered("FALSEPREDICATE");
10
+ // 01_単元別の抽出
11
+ if (selected.type === "unit") {
12
+ var category = selected.category, lesson = selected.lesson;
13
+ if (lesson.key === 0)
14
+ questions = (0, questionFilterJ_1.getUnitQuestionsJ)(QuestionDB, category);
15
+ else
16
+ questions = (0, questionFilterJ_1.getSubUnitQuestionsJ)(QuestionDB, category, lesson.key);
17
+ }
18
+ // 04_タグによる絞り込み
19
+ questions = (0, questionFilterJ_1.filterByTagsJ)(questions, startCfg, tagName);
20
+ // 05_共通処理(シャッフル・問題数)(ここで配列化)
21
+ // (選択肢を変更しシャッフル)
22
+ var _a = startCfg.option, quizCnt = _a.quizCnt, isShuffle = _a.isShuffle;
23
+ var formatted = (0, questionFormatJ_1.formatQuestionsJ)(questions, startCfg.option, tagName);
24
+ var filtered = (0, questionFilterJ_1.commonFilterJ)(formatted, quizCnt, isShuffle);
25
+ return filtered;
26
+ };
27
+ exports.getBasicQuizListJ = getBasicQuizListJ;
28
+ // ミニテストの問題を取得
29
+ // const testCfgOption: StartCfg['option'] = {
30
+ var getMiniTestQuestionsJ = function (QuestionDB, key, cnt, tagName) {
31
+ if (cnt === void 0) { cnt = 10; }
32
+ if (tagName === void 0) { tagName = "basicTag"; }
33
+ var testCfgOption = createStartOption(cnt, "selectEnglish", 10);
34
+ var questions = QuestionDB.filtered("FALSEPREDICATE");
35
+ questions = (0, questionFilterJ_1.getUnitQuestionsJ)(QuestionDB, key);
36
+ var formatted = (0, questionFormatJ_1.formatQuestionsJ)(questions, testCfgOption, tagName);
37
+ return (0, questionFilterJ_1.commonFilterJ)(formatted, cnt, true);
38
+ };
39
+ exports.getMiniTestQuestionsJ = getMiniTestQuestionsJ;
40
+ // 模擬試験の開始(Randam)
41
+ var getTestQuestionsJ = function (QuestionDB, cnt, tagName) {
42
+ if (tagName === void 0) { tagName = "basicTag"; }
43
+ // シャッフルしてから必要な数だけ抽出
44
+ var totalCnt = QuestionDB.length;
45
+ var numArray = lib_1.utilFnc.createArrayBasedOnCnt(cnt, totalCnt);
46
+ var randomItems = Array.from(numArray).map(function (index) { return QuestionDB[index]; });
47
+ var formatted = (0, questionFormatJ_1.formatQuestionsJ)(randomItems, createStartOption(cnt, "selectEnglish"), tagName);
48
+ var filttered = (0, questionFilterJ_1.commonFilterJ)(formatted, cnt, false);
49
+ return filttered;
50
+ };
51
+ exports.getTestQuestionsJ = getTestQuestionsJ;
52
+ // startCfgの作成
53
+ var createStartOption = function (cnt, pattern, timeLimit) {
54
+ if (timeLimit === void 0) { timeLimit = 10; }
55
+ return ({
56
+ tagMove: "move",
57
+ quizCnt: cnt,
58
+ isShuffle: true,
59
+ jlptPattern: pattern,
60
+ timeLimit: timeLimit,
61
+ isSound: true,
62
+ });
63
+ };
@@ -146,7 +146,7 @@ var promptStoreReview = function (totalCnt) { return __awaiter(void 0, void 0, v
146
146
  return __generator(this, function (_a) {
147
147
  switch (_a.label) {
148
148
  case 0:
149
- if (totalCnt < 200)
149
+ if (totalCnt < 40)
150
150
  return [2 /*return*/];
151
151
  return [4 /*yield*/, StoreReview.isAvailableAsync()];
152
152
  case 1:
@@ -1,8 +1,6 @@
1
- import { Results } from "realm";
2
1
  import { dQuestionSchema } from "@nakamura-123/db";
3
2
  import { Store } from "@nakamura-123/types";
4
- type QuestionType = typeof dQuestionSchema.prototype;
5
- type QR = Results<QuestionType>;
3
+ type QR = Realm.Results<dQuestionSchema>;
6
4
  export declare const getUnitQuestions: (questions: QR, unitId: number) => QR;
7
5
  export declare const getSubUnitQuestions: (questions: QR, unitId: number, subUnitId: number) => QR;
8
6
  export declare const getYearQuestions: (questions: QR, year: number) => QR;
@@ -0,0 +1,14 @@
1
+ import { Store } from "@nakamura-123/types";
2
+ import { QRD } from "../types/filterType";
3
+ export declare const getUnitQuestions: (questions: QRD, unitId: number) => QRD;
4
+ export declare const getSubUnitQuestions: (questions: QRD, unitId: number, subUnitId: number) => QRD;
5
+ export declare const getYearQuestions: (questions: QRD, year: number) => QRD;
6
+ export declare const getSubYearQuestions: (questions: QRD, year: number, key: number) => QRD;
7
+ export declare const filterByOutOfYearRange: (questions: QRD, outOfYearRange: number[]) => QRD;
8
+ export declare const filterByOutOfUnitRange: (questions: QRD, outOfUnitRange: number[]) => QRD;
9
+ export declare const filterByTags: (questions: QRD, startCfg: {
10
+ tags: import("@nakamura-123/types/dist/types/libType").LevelNames[];
11
+ option: import("@nakamura-123/lib/dist/config/startOption").QuizStartOptionValue;
12
+ outOfYearRange: number[];
13
+ }) => QRD;
14
+ export declare const commonFilter: (questions: Store.DQInStore[], quizCnt: number, isShuffle: boolean) => Store.DQInStore[];
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
+ if (ar || !(i in from)) {
5
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
+ ar[i] = from[i];
7
+ }
8
+ }
9
+ return to.concat(ar || Array.prototype.slice.call(from));
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.commonFilter = exports.filterByTags = exports.filterByOutOfUnitRange = exports.filterByOutOfYearRange = exports.getSubYearQuestions = exports.getYearQuestions = exports.getSubUnitQuestions = exports.getUnitQuestions = void 0;
13
+ var lib_1 = require("@nakamura-123/lib");
14
+ var filters = {
15
+ unit: "unitId == $0 && subUnitId == $1",
16
+ unitTop: "unitId == $0",
17
+ year: "yearId == $0 && subYearId == $1",
18
+ yearTop: "yearId == $0",
19
+ };
20
+ // 01_単元別(大単元)の抽出
21
+ var getUnitQuestions = function (questions, unitId) {
22
+ return questions.filtered(filters.unitTop, unitId);
23
+ };
24
+ exports.getUnitQuestions = getUnitQuestions;
25
+ // 02_単元別(小単元)の抽出
26
+ var getSubUnitQuestions = function (questions, unitId, subUnitId) {
27
+ return questions.filtered(filters.unit, unitId, subUnitId);
28
+ };
29
+ exports.getSubUnitQuestions = getSubUnitQuestions;
30
+ // 03_年度別(大単元)の抽出
31
+ var getYearQuestions = function (questions, year) {
32
+ return questions.filtered(filters.yearTop, year);
33
+ };
34
+ exports.getYearQuestions = getYearQuestions;
35
+ // 04_年度別(小単元)の抽出
36
+ var getSubYearQuestions = function (questions, year, key) {
37
+ return questions.filtered(filters.year, year, key);
38
+ };
39
+ exports.getSubYearQuestions = getSubYearQuestions;
40
+ // 05_試験範囲外の問題を除外(year)
41
+ var filterByOutOfYearRange = function (questions, outOfYearRange) {
42
+ if (outOfYearRange.length === 0)
43
+ return questions;
44
+ var condition = outOfYearRange
45
+ .map(function (_, index) { return "yearId != $".concat(index); })
46
+ .join(" AND ");
47
+ var filteredQuestions = questions.filtered.apply(questions, __spreadArray([condition], outOfYearRange, false));
48
+ return filteredQuestions;
49
+ };
50
+ exports.filterByOutOfYearRange = filterByOutOfYearRange;
51
+ // 06_単元範囲外の問題を除外(unit)
52
+ var filterByOutOfUnitRange = function (questions, outOfUnitRange) {
53
+ if (outOfUnitRange.length === 0)
54
+ return questions;
55
+ var condition = outOfUnitRange
56
+ .map(function (_, index) { return "unitId != $".concat(index); })
57
+ .join(" AND ");
58
+ var filteredQuestions = questions.filtered.apply(questions, __spreadArray([condition], outOfUnitRange, false));
59
+ return filteredQuestions;
60
+ };
61
+ exports.filterByOutOfUnitRange = filterByOutOfUnitRange;
62
+ // 11_タグによる絞り込み
63
+ var filterByTags = function (questions, startCfg) {
64
+ var selectedTags = startCfg.tags;
65
+ var filterByTags = questions.filtered("tag.level IN $0", selectedTags);
66
+ return filterByTags;
67
+ };
68
+ exports.filterByTags = filterByTags;
69
+ // 12_シャッフル
70
+ // 13_問題数の設定
71
+ var commonFilter = function (questions, quizCnt, isShuffle) {
72
+ // 12_シャッフル
73
+ var returnList = questions;
74
+ if (isShuffle)
75
+ returnList = lib_1.utilFnc.shuffleList(questions);
76
+ // 13_問題数の設定
77
+ return returnList.slice(0, quizCnt);
78
+ };
79
+ exports.commonFilter = commonFilter;
@@ -0,0 +1,10 @@
1
+ import { QRJ } from "../types/filterType";
2
+ import { Db, JStore } from "@nakamura-123/types";
3
+ export declare const getUnitQuestionsJ: (questions: QRJ, unitId: number) => QRJ;
4
+ export declare const getSubUnitQuestionsJ: (questions: QRJ, unitId: number, subUnitId: number) => QRJ;
5
+ export declare const filterByTagsJ: (questions: QRJ, startCfg: {
6
+ tags: import("@nakamura-123/types/dist/types/libType").LevelNames[];
7
+ option: import("@nakamura-123/lib/dist/config/startOption").QuizStartOptionValue;
8
+ outOfYearRange: number[];
9
+ }, tagName: Db.SubjectTag) => QRJ;
10
+ export declare const commonFilterJ: (questions: JStore.JQInStore[], quizCnt: number, isShuffle: boolean) => JStore.JQInStore[];
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.commonFilterJ = exports.filterByTagsJ = exports.getSubUnitQuestionsJ = exports.getUnitQuestionsJ = void 0;
4
+ var lib_1 = require("@nakamura-123/lib");
5
+ var FILTERS = {
6
+ unitTop: "unitId == $0",
7
+ unit: "unitId == $0 && subUnitId == $1",
8
+ };
9
+ // 01_単元別(大単元)の抽出
10
+ var getUnitQuestionsJ = function (questions, unitId) {
11
+ return questions.filtered(FILTERS.unitTop, unitId);
12
+ };
13
+ exports.getUnitQuestionsJ = getUnitQuestionsJ;
14
+ // 02_単元別(小単元)の抽出
15
+ var getSubUnitQuestionsJ = function (questions, unitId, subUnitId) {
16
+ return questions.filtered(FILTERS.unit, unitId, subUnitId);
17
+ };
18
+ exports.getSubUnitQuestionsJ = getSubUnitQuestionsJ;
19
+ // 11_タグによる絞り込み
20
+ var filterByTagsJ = function (questions, startCfg, tagName) {
21
+ var selectedTags = startCfg.tags;
22
+ var filterByTags = questions.filtered("".concat(tagName, ".level IN $0"), selectedTags);
23
+ return filterByTags;
24
+ };
25
+ exports.filterByTagsJ = filterByTagsJ;
26
+ // 12_シャッフル
27
+ // 13_問題数の設定
28
+ var commonFilterJ = function (questions, quizCnt, isShuffle) {
29
+ // 12_シャッフル
30
+ var returnList = questions;
31
+ if (isShuffle)
32
+ returnList = lib_1.utilFnc.shuffleList(questions);
33
+ // 13_問題数の設定
34
+ return returnList.slice(0, quizCnt);
35
+ };
36
+ exports.commonFilterJ = commonFilterJ;
@@ -0,0 +1,5 @@
1
+ import { JQuestionSchema } from "@nakamura-123/db";
2
+ type QR = Realm.Results<JQuestionSchema>;
3
+ export declare const getUnitQuestions: (questions: QR, unitId: number) => QR;
4
+ export declare const getSubUnitQuestions: (questions: QR, unitId: number, subUnitId: number) => QR;
5
+ export {};
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSubUnitQuestions = exports.getUnitQuestions = void 0;
4
+ var FILTERS = {
5
+ unit: "unitId == $0 && subUnitId == $1",
6
+ unitTop: "unitId == $0",
7
+ };
8
+ // 01_単元別(大単元)の抽出
9
+ var getUnitQuestions = function (questions, unitId) {
10
+ return questions.filtered(FILTERS.unitTop, unitId);
11
+ };
12
+ exports.getUnitQuestions = getUnitQuestions;
13
+ // 02_単元別(小単元)の抽出
14
+ var getSubUnitQuestions = function (questions, unitId, subUnitId) {
15
+ return questions.filtered(FILTERS.unit, unitId, subUnitId);
16
+ };
17
+ exports.getSubUnitQuestions = getSubUnitQuestions;
@@ -0,0 +1,7 @@
1
+ import { Results } from "realm";
2
+ import { DQuestionSchema } from "@nakamura-123/db";
3
+ import { Store } from "@nakamura-123/types";
4
+ type QuestionType = typeof DQuestionSchema.prototype;
5
+ type QR = Results<QuestionType>;
6
+ export declare const formatQuestions: (questions: QR | QuestionType[]) => Store.DQInStore[];
7
+ export {};
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.formatQuestions = void 0;
15
+ var lib_1 = require("@nakamura-123/lib");
16
+ // OO_メインの出力
17
+ var formatQuestions = function (questions) {
18
+ var formattedQuestions = questions.map(function (question) {
19
+ var jsonQuestion = question.toJSON();
20
+ var form = jsonQuestion.form;
21
+ switch (form) {
22
+ case "multi":
23
+ return formatMulti(jsonQuestion);
24
+ case "blank":
25
+ return formatBlank(jsonQuestion);
26
+ case "input":
27
+ return formatInput(jsonQuestion);
28
+ default:
29
+ return formatNormal(jsonQuestion);
30
+ }
31
+ });
32
+ return formattedQuestions;
33
+ };
34
+ exports.formatQuestions = formatQuestions;
35
+ // 10_共通部分を抽出するヘルパー関数
36
+ var formatCommon = function (Q) { return ({
37
+ yearId: Q.yearId,
38
+ num: Q.num,
39
+ question: Q.question,
40
+ title: Q.title,
41
+ tag: Q.tag.level,
42
+ style: Q.style,
43
+ explain: Q.explain.explain,
44
+ isCorrected: undefined,
45
+ }); };
46
+ // 11_通常形式のフォーマット
47
+ var formatNormal = function (Q) {
48
+ return __assign(__assign({}, formatCommon(Q)), { choices: getNormalChoice(Q.choices, Q.ans), form: undefined, ans: Q.ans, selectedIndexes: [] });
49
+ };
50
+ // 12_multi形式のフォーマット
51
+ var formatMulti = function (Q) {
52
+ return __assign(__assign({}, formatCommon(Q)), { form: "multi", multiSel: getMultiChoice(Q.multiChoicesJson), selectedIndexes: [] });
53
+ };
54
+ // 13_穴埋め形式のフォーマット
55
+ var formatBlank = function (Q) {
56
+ return __assign(__assign({}, formatCommon(Q)), { form: "blank", blankAns: Q.blankAns });
57
+ };
58
+ // 14_記述形式のフォーマット
59
+ var formatInput = function (Q) {
60
+ return __assign(__assign({}, formatCommon(Q)), { form: "input", inputId: Q.input.inputId });
61
+ };
62
+ // 21_(01)選択肢をオブジェクト化しシャッフルする
63
+ var getNormalChoice = function (choices, ans) {
64
+ if (!choices)
65
+ return [];
66
+ var choicesObj = choices.map(function (choice, index) { return ({
67
+ choice: choice,
68
+ num: index + 1,
69
+ isCorrect: ans.includes(index + 1),
70
+ }); });
71
+ var shuffledChoices = lib_1.utilFnc.shuffleList(choicesObj);
72
+ return shuffledChoices;
73
+ };
74
+ var getMultiChoice = function (choices) {
75
+ // json形式をオブジェクトに変換
76
+ var choicesObj = JSON.parse(choices);
77
+ var formattedChoices = choicesObj.map(function (array) {
78
+ return array.map(function (choice, index) { return ({
79
+ choice: choice,
80
+ num: index + 1,
81
+ isCorrect: index === 0,
82
+ }); });
83
+ });
84
+ // 選択肢をシャッフル
85
+ var shuffledChoices = formattedChoices.map(function (array) {
86
+ var _a;
87
+ var _b, _c, _d, _e, _f, _g;
88
+ var isMaruBatsu = (((_c = (_b = array[0]) === null || _b === void 0 ? void 0 : _b.choice) === null || _c === void 0 ? void 0 : _c.startsWith("○")) ||
89
+ ((_e = (_d = array[0]) === null || _d === void 0 ? void 0 : _d.choice) === null || _e === void 0 ? void 0 : _e.startsWith("×"))) &&
90
+ array.length === 2;
91
+ if (isMaruBatsu) {
92
+ // isMaruBatsuがtrueの場合
93
+ if ((_g = (_f = array[0]) === null || _f === void 0 ? void 0 : _f.choice) === null || _g === void 0 ? void 0 : _g.startsWith("×")) {
94
+ // choiceが○以外なら入れ替える
95
+ _a = [array[1], array[0]], array[0] = _a[0], array[1] = _a[1];
96
+ }
97
+ return array;
98
+ }
99
+ // isMaruBatsuがfalseならシャッフル
100
+ return lib_1.utilFnc.shuffleList(array);
101
+ });
102
+ return shuffledChoices;
103
+ };
@@ -1,7 +1,7 @@
1
1
  import { Results } from "realm";
2
- import { dQuestionSchema } from "@nakamura-123/db";
2
+ import { DQuestionSchema } from "@nakamura-123/db";
3
3
  import { Store } from "@nakamura-123/types";
4
- type QuestionType = typeof dQuestionSchema.prototype;
4
+ type QuestionType = typeof DQuestionSchema.prototype;
5
5
  type QR = Results<QuestionType>;
6
6
  export declare const formatQuestions: (questions: QR | QuestionType[]) => Store.DQInStore[];
7
7
  export {};
@@ -0,0 +1,7 @@
1
+ import { Results } from "realm";
2
+ import { DQuestionSchema } from "@nakamura-123/db";
3
+ import { Store } from "@nakamura-123/types";
4
+ type QuestionType = typeof DQuestionSchema.prototype;
5
+ type QR = Results<QuestionType>;
6
+ export declare const formatQuestions: (questions: QR | QuestionType[]) => Store.DQInStore[];
7
+ export {};
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.formatQuestions = void 0;
15
+ var lib_1 = require("@nakamura-123/lib");
16
+ // OO_メインの出力
17
+ var formatQuestions = function (questions) {
18
+ var formattedQuestions = questions.map(function (question) {
19
+ var jsonQuestion = question.toJSON();
20
+ var form = jsonQuestion.form;
21
+ switch (form) {
22
+ case "multi":
23
+ return formatMulti(jsonQuestion);
24
+ case "blank":
25
+ return formatBlank(jsonQuestion);
26
+ case "input":
27
+ return formatInput(jsonQuestion);
28
+ default:
29
+ return formatNormal(jsonQuestion);
30
+ }
31
+ });
32
+ return formattedQuestions;
33
+ };
34
+ exports.formatQuestions = formatQuestions;
35
+ // 10_共通部分を抽出するヘルパー関数
36
+ var formatCommon = function (Q) { return ({
37
+ system: "drill",
38
+ yearId: Q.yearId,
39
+ num: Q.num,
40
+ question: Q.question,
41
+ title: Q.title,
42
+ tag: Q.tag.level,
43
+ style: Q.style,
44
+ explain: Q.explain.explain,
45
+ isCorrected: undefined,
46
+ }); };
47
+ // 11_通常形式のフォーマット
48
+ var formatNormal = function (Q) {
49
+ return __assign(__assign({}, formatCommon(Q)), { choices: getNormalChoice(Q.choices, Q.ans), form: undefined, ans: Q.ans, selectedIndexes: [] });
50
+ };
51
+ // 12_multi形式のフォーマット
52
+ var formatMulti = function (Q) {
53
+ return __assign(__assign({}, formatCommon(Q)), { form: "multi", multiSel: getMultiChoice(Q.multiChoicesJson), selectedIndexes: [] });
54
+ };
55
+ // 13_穴埋め形式のフォーマット
56
+ var formatBlank = function (Q) {
57
+ return __assign(__assign({}, formatCommon(Q)), { form: "blank", blankAns: Q.blankAns });
58
+ };
59
+ // 14_記述形式のフォーマット
60
+ var formatInput = function (Q) {
61
+ return __assign(__assign({}, formatCommon(Q)), { form: "input", inputId: Q.input.inputId });
62
+ };
63
+ // 21_(01)選択肢をオブジェクト化しシャッフルする
64
+ var getNormalChoice = function (choices, ans) {
65
+ if (!choices)
66
+ return [];
67
+ var choicesObj = choices.map(function (choice, index) { return ({
68
+ choice: choice,
69
+ num: index + 1,
70
+ isCorrect: ans.includes(index + 1),
71
+ }); });
72
+ var shuffledChoices = lib_1.utilFnc.shuffleList(choicesObj);
73
+ return shuffledChoices;
74
+ };
75
+ var getMultiChoice = function (choices) {
76
+ // json形式をオブジェクトに変換
77
+ var choicesObj = JSON.parse(choices);
78
+ var formattedChoices = choicesObj.map(function (array) {
79
+ return array.map(function (choice, index) { return ({
80
+ choice: choice,
81
+ num: index + 1,
82
+ isCorrect: index === 0,
83
+ }); });
84
+ });
85
+ // 選択肢をシャッフル
86
+ var shuffledChoices = formattedChoices.map(function (array) {
87
+ var _a;
88
+ var _b, _c, _d, _e, _f, _g;
89
+ var isMaruBatsu = (((_c = (_b = array[0]) === null || _b === void 0 ? void 0 : _b.choice) === null || _c === void 0 ? void 0 : _c.startsWith("○")) ||
90
+ ((_e = (_d = array[0]) === null || _d === void 0 ? void 0 : _d.choice) === null || _e === void 0 ? void 0 : _e.startsWith("×"))) &&
91
+ array.length === 2;
92
+ if (isMaruBatsu) {
93
+ // isMaruBatsuがtrueの場合
94
+ if ((_g = (_f = array[0]) === null || _f === void 0 ? void 0 : _f.choice) === null || _g === void 0 ? void 0 : _g.startsWith("×")) {
95
+ // choiceが○以外なら入れ替える
96
+ _a = [array[1], array[0]], array[0] = _a[0], array[1] = _a[1];
97
+ }
98
+ return array;
99
+ }
100
+ // isMaruBatsuがfalseならシャッフル
101
+ return lib_1.utilFnc.shuffleList(array);
102
+ });
103
+ return shuffledChoices;
104
+ };
@@ -0,0 +1,8 @@
1
+ import { JQuestionSchema } from "@nakamura-123/db";
2
+ import { Db, JStore } from "@nakamura-123/types";
3
+ import { startOption } from "@nakamura-123/lib";
4
+ import { QRJ } from "../types/filterType";
5
+ type QuestionType = typeof JQuestionSchema.prototype;
6
+ type startOption = startOption.QuizStartOptionValue;
7
+ export declare const formatQuestionsJ: (questions: QRJ | QuestionType[], startOption: startOption.QuizStartOptionValue, tagName: Db.SubjectTag) => JStore.JQInStore[];
8
+ export {};
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.formatQuestionsJ = void 0;
15
+ var lib_1 = require("@nakamura-123/lib");
16
+ // OO_メインの出力
17
+ var formatQuestionsJ = function (questions, startOption, tagName) {
18
+ var jlptPattern = startOption.jlptPattern;
19
+ var formattedQuestions = questions.map(function (question) {
20
+ var quizForm = getQuizForm(jlptPattern, tagName);
21
+ switch (quizForm) {
22
+ case "basicSelEn":
23
+ return formatBasicSelEn(question, startOption);
24
+ case "basicSelJp":
25
+ return formatBasicSelJp(question, startOption);
26
+ case "basicSelImg":
27
+ return formatBasicSelImg(question, startOption);
28
+ case "listenSelEn":
29
+ return formatListenSelEn(question, startOption);
30
+ case "listenSelJp":
31
+ return formatListenSelJp(question, startOption);
32
+ case "listenSelImg":
33
+ return formatListenSelImg(question, startOption);
34
+ default:
35
+ return formatBasicSelEn(question, startOption);
36
+ }
37
+ });
38
+ return formattedQuestions;
39
+ };
40
+ exports.formatQuestionsJ = formatQuestionsJ;
41
+ // 10_共通部分を抽出するヘルパー関数
42
+ var formatCommonJ = function (Q, SO) { return ({
43
+ system: "JLPT",
44
+ quizId: Q.quizId,
45
+ isCorrected: undefined,
46
+ selectedIndexes: [],
47
+ jpWord: Q.jpWord,
48
+ jpYomi: Q.jpYomi,
49
+ jpSentence: Q.jpSentence,
50
+ enWord: Q.enWord,
51
+ enSentence: Q.enSentence,
52
+ timeLimit: SO.timeLimit * 1000,
53
+ isSound: SO.isSound,
54
+ }); };
55
+ // 11_それぞれののフォーマット
56
+ var formatBasicSelEn = function (Q, SO) {
57
+ return __assign(__assign({}, formatCommonJ(Q, SO)), { form: "basicSelEn", question: Q.jpWord, choices: getNormalChoice(Q.enSelect), tagName: "basicTag", tag: Q.basicTag.level });
58
+ };
59
+ var formatBasicSelJp = function (Q, SO) {
60
+ return __assign(__assign({}, formatCommonJ(Q, SO)), { form: "basicSelJp", question: Q.enWord, choices: getNormalChoice(Q.jpSelect), tagName: "basicTag", tag: Q.basicTag.level });
61
+ };
62
+ var formatBasicSelImg = function (Q, SO) {
63
+ return __assign(__assign({}, formatCommonJ(Q, SO)), { form: "basicSelImg", question: Q.jpSentence, choices: getNormalChoice(Q.imgSelect), tagName: "basicTag", tag: Q.basicTag.level });
64
+ };
65
+ var formatListenSelEn = function (Q, SO) {
66
+ return __assign(__assign({}, formatCommonJ(Q, SO)), { form: "listenSelEn", question: Q.jpWord, choices: getNormalChoice(Q.enSelect), tagName: "listenTag", tag: Q.listenTag.level });
67
+ };
68
+ var formatListenSelJp = function (Q, SO) {
69
+ return __assign(__assign({}, formatCommonJ(Q, SO)), { form: "listenSelJp", question: Q.enWord, choices: getNormalChoice(Q.jpSelect), tagName: "listenTag", tag: Q.listenTag.level });
70
+ };
71
+ var formatListenSelImg = function (Q, SO) {
72
+ return __assign(__assign({}, formatCommonJ(Q, SO)), { form: "listenSelImg", question: Q.jpSentence, choices: getNormalChoice(Q.imgSelect), tagName: "listenTag", tag: Q.listenTag.level });
73
+ };
74
+ // 21_(01)選択肢をオブジェクト化しシャッフルする
75
+ var getNormalChoice = function (choices) {
76
+ if (!choices)
77
+ return [];
78
+ var choicesObj = choices.map(function (choice, index) { return ({
79
+ choice: choice,
80
+ num: index + 1,
81
+ isCorrect: index === 0,
82
+ }); });
83
+ var shuffledChoices = lib_1.utilFnc.shuffleList(choicesObj);
84
+ return shuffledChoices;
85
+ };
86
+ // 31_フォームの種類を取得
87
+ var getQuizForm = function (jlptPattern, tagName) {
88
+ var baseKey = tagName === "basicTag" ? "basic" : "listen";
89
+ var patternMap = {
90
+ selectEnglish: "".concat(baseKey, "SelEn"),
91
+ selectJapanese: "".concat(baseKey, "SelJp"),
92
+ selectImg: "".concat(baseKey, "SelImg"),
93
+ };
94
+ return patternMap[jlptPattern];
95
+ };