@nakamura-123/pages 1.3.16 → 1.4.1
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/Article/ArticleCategoryList.js +88 -33
- package/dist/component/Article/ArticleContentView.d.ts +1 -0
- package/dist/component/Article/ArticleContentView.js +56 -14
- package/dist/component/Article/ArticleRow.d.ts +3 -2
- package/dist/component/Article/ArticleRow.js +42 -16
- package/dist/component/Basic/BasicProgressBar.js +7 -5
- package/dist/component/Basic/MiniTestCard.js +15 -9
- package/dist/component/Basic/Paw5s.js +2 -1
- package/dist/component/Basic/SubCategoryList.js +13 -18
- package/dist/component/Coin/CoinCheck.js +1 -1
- package/dist/component/Coin/CoinFnc.d.ts +2 -2
- package/dist/component/Coin/CoinFnc.js +13 -11
- package/dist/component/Coin/WaitingPayBanner.js +2 -3
- package/dist/component/Grade/GAllTags.d.ts +3 -0
- package/dist/component/Grade/GAllTags.js +45 -0
- package/dist/component/Grade/GradeCard/ChangeWeeklyModal.js +7 -3
- package/dist/component/Grade/GradeCard/DatePickerModal.js +2 -1
- package/dist/component/Grade/GradeCard/Square3sGrade.js +1 -1
- package/dist/component/Grade/GradeCard/TargetDate.js +1 -1
- package/dist/component/Grade/QuizCntGraph.js +2 -1
- package/dist/component/Grade/Square4s.js +4 -4
- package/dist/component/Grade/UnitCircles.d.ts +4 -2
- package/dist/component/Grade/UnitCircles.js +6 -5
- package/dist/component/Grade/YearCircles.d.ts +4 -2
- package/dist/component/Grade/YearCircles.js +7 -5
- package/dist/component/KeyboardCloseBar.js +2 -1
- package/dist/component/QuizSet/QuizOptionDrill.js +3 -14
- package/dist/component/Result/QuizFlatList.js +161 -57
- package/dist/component/Result/ResultActions.d.ts +7 -0
- package/dist/component/Result/ResultActions.js +107 -0
- package/dist/component/Result/ResultHero.d.ts +7 -0
- package/dist/component/Result/ResultHero.js +166 -0
- package/dist/component/SettingBtns/LanguageModal.d.ts +9 -0
- package/dist/component/SettingBtns/LanguageModal.js +103 -0
- package/dist/component/SettingBtns/TransBtn.js +7 -84
- package/dist/component/Tag5s.js +2 -2
- package/dist/component/TagBadge5s.js +7 -5
- package/dist/component/TestPage/BarChartContainer.js +2 -1
- package/dist/component/TestPage/Square3s.js +3 -2
- package/dist/engine/components.d.ts +19 -0
- package/dist/engine/components.js +19 -0
- package/dist/engine/drill.d.ts +3 -0
- package/dist/engine/drill.js +24 -0
- package/dist/engine/grammar.d.ts +3 -0
- package/dist/engine/grammar.js +22 -0
- package/dist/engine/index.d.ts +5 -0
- package/dist/engine/index.js +17 -0
- package/dist/engine/tango.d.ts +3 -0
- package/dist/engine/tango.js +28 -0
- package/dist/engine/types.d.ts +46 -0
- package/dist/engine/types.js +2 -0
- package/dist/functions/createQuizFncG.d.ts +12 -0
- package/dist/functions/createQuizFncG.js +40 -0
- package/dist/functions/nextItemFnc.d.ts +12 -0
- package/dist/functions/nextItemFnc.js +56 -0
- package/dist/functions/questionFormatD.d.ts +1 -0
- package/dist/functions/questionFormatD.js +14 -13
- package/dist/functions/questionFormatG.d.ts +7 -0
- package/dist/functions/questionFormatG.js +31 -0
- package/dist/functions/retryQuizFnc.d.ts +1 -0
- package/dist/functions/retryQuizFnc.js +13 -0
- package/dist/functions/tagFncG.d.ts +5 -0
- package/dist/functions/tagFncG.js +24 -0
- package/dist/functions/tagFncJ.d.ts +2 -2
- package/dist/functions/tagFncJ.js +1 -1
- package/dist/hooks/BadgeHook.d.ts +1 -1
- package/dist/hooks/BadgeHook.js +3 -3
- package/dist/hooks/ExitQuizHook.js +9 -7
- package/dist/hooks/basicHook.d.ts +9 -1
- package/dist/hooks/basicHook.js +17 -8
- package/dist/hooks/quizActionHook.d.ts +3 -1
- package/dist/hooks/quizActionHook.js +33 -1
- package/dist/hooks/quizHook.d.ts +6 -2
- package/dist/hooks/quizHook.js +39 -4
- package/dist/hooks/resultHook.d.ts +10 -0
- package/dist/hooks/resultHook.js +85 -0
- package/dist/page/ArticleDetail.js +25 -12
- package/dist/page/CoinPage.js +2 -2
- package/dist/page/FAQPage.js +4 -3
- package/dist/page/GetBadgePage.js +5 -4
- package/dist/page/GradePage.js +6 -9
- package/dist/page/HistoryPage.js +7 -4
- package/dist/page/HomePage.js +7 -3
- package/dist/page/QuizPage.js +4 -4
- package/dist/page/QuizSettingPage.js +3 -6
- package/dist/page/QuizSetupPage.js +6 -14
- package/dist/page/ReportPage.js +1 -1
- package/dist/page/ResultPage.js +8 -25
- package/dist/page/SettingPage.js +36 -3
- package/dist/page/TestPage.js +7 -14
- package/dist/quiz/Title.js +5 -2
- package/dist/quiz/check/Check.js +11 -7
- package/dist/quiz/check/NextQuizBtn.js +3 -2
- package/dist/quiz/check/SelectTag.js +7 -0
- package/dist/quiz/common/MyTextqqyy.d.ts +1 -0
- package/dist/quiz/common/MyTextqqyy.js +2 -2
- package/dist/quiz/common/RenderImgOrText.d.ts +2 -0
- package/dist/quiz/common/RenderImgOrText.js +2 -2
- package/dist/quiz/common/RubyText.d.ts +3 -1
- package/dist/quiz/common/RubyText.js +20 -5
- package/dist/quiz/grammar/GAnswer.d.ts +8 -0
- package/dist/quiz/grammar/GAnswer.js +115 -0
- package/dist/quiz/grammar/GGuideBtn.d.ts +8 -0
- package/dist/quiz/grammar/GGuideBtn.js +43 -0
- package/dist/quiz/grammar/GQuestion.d.ts +8 -0
- package/dist/quiz/grammar/GQuestion.js +109 -0
- package/dist/quiz/grammar/QuizContentsGrammar.d.ts +10 -0
- package/dist/quiz/grammar/QuizContentsGrammar.js +31 -0
- package/dist/quiz/jAnswer/JAnswerContents.js +12 -5
- package/dist/quiz/jQuestion/JQuestionBottomText.d.ts +2 -1
- package/dist/quiz/jQuestion/JQuestionBottomText.js +3 -1
- package/dist/quiz/save/QuizSaveData.js +1 -1
- package/dist/quiz/setting/Above3BtnJ.js +5 -4
- package/dist/quiz/setting/Bottom3Btn.js +5 -4
- package/dist/quiz/setting/GuideBtn.js +3 -2
- package/dist/quiz/setting/RepeatBtn.js +2 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/filterType.d.ts +2 -1
- package/package.json +23 -3
|
@@ -22,100 +22,23 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
25
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
29
|
const react_1 = __importStar(require("react"));
|
|
27
30
|
const react_native_1 = require("react-native");
|
|
28
31
|
const common_1 = require("@nakamura-123/common");
|
|
29
|
-
const
|
|
30
|
-
const react_redux_1 = require("react-redux");
|
|
31
|
-
const stores_1 = require("@nakamura-123/stores");
|
|
32
|
+
const LanguageModal_1 = __importDefault(require("./LanguageModal"));
|
|
32
33
|
const TransBtn = ({}) => {
|
|
33
34
|
const [modalVisible, setModalVisible] = (0, react_1.useState)(false);
|
|
34
|
-
const dispatch = (0, react_redux_1.useDispatch)();
|
|
35
|
-
const { i18n } = (0, common_1.useDrillTranslation)();
|
|
36
|
-
const handlePress = () => {
|
|
37
|
-
setModalVisible(true);
|
|
38
|
-
};
|
|
39
|
-
const handleLanguageSelect = (language) => {
|
|
40
|
-
i18n === null || i18n === void 0 ? void 0 : i18n.changeLanguage(language); // 言語を切り替える
|
|
41
|
-
dispatch({ type: "setting/setLanguage", payload: language });
|
|
42
|
-
dispatch(stores_1.settingStorage.saveSetting());
|
|
43
|
-
setModalVisible(false);
|
|
44
|
-
};
|
|
45
35
|
return (<react_native_1.View style={styles.container}>
|
|
46
|
-
<common_1.IconInCircle name="language" cStyle={styles.button} onPress={
|
|
47
|
-
<
|
|
48
|
-
<react_native_1.View style={styles.modalContainer}>
|
|
49
|
-
<react_native_1.View style={styles.modalContent}>
|
|
50
|
-
<react_native_1.Text style={styles.modalTitle}>Select Language</react_native_1.Text>
|
|
51
|
-
<react_native_1.TouchableOpacity style={styles.modalButton} onPress={() => handleLanguageSelect("en")} // 英語を選択
|
|
52
|
-
>
|
|
53
|
-
<react_native_1.Text style={styles.modalButtonText}>English</react_native_1.Text>
|
|
54
|
-
</react_native_1.TouchableOpacity>
|
|
55
|
-
<react_native_1.TouchableOpacity style={styles.modalButton} onPress={() => handleLanguageSelect("ja")} // 日本語を選択
|
|
56
|
-
>
|
|
57
|
-
<react_native_1.Text style={styles.modalButtonText}>Japanese</react_native_1.Text>
|
|
58
|
-
</react_native_1.TouchableOpacity>
|
|
59
|
-
<react_native_1.TouchableOpacity style={styles.modalCloseButton} onPress={() => setModalVisible(false)}>
|
|
60
|
-
<react_native_1.Text style={styles.modalCloseButtonText}>Close</react_native_1.Text>
|
|
61
|
-
</react_native_1.TouchableOpacity>
|
|
62
|
-
</react_native_1.View>
|
|
63
|
-
</react_native_1.View>
|
|
64
|
-
</react_native_1.Modal>
|
|
36
|
+
<common_1.IconInCircle name="language" cStyle={styles.button} onPress={() => setModalVisible(true)} circleColor="dkBeige" iconColor="white"/>
|
|
37
|
+
<LanguageModal_1.default visible={modalVisible} onClose={() => setModalVisible(false)}/>
|
|
65
38
|
</react_native_1.View>);
|
|
66
39
|
};
|
|
67
40
|
const styles = react_native_1.StyleSheet.create({
|
|
68
41
|
container: { marginRight: 10 },
|
|
69
|
-
button: {
|
|
70
|
-
// borderWidth: 3,
|
|
71
|
-
// borderColor: colors.white,
|
|
72
|
-
},
|
|
73
|
-
text: {
|
|
74
|
-
color: "#FFFFFF",
|
|
75
|
-
fontSize: 16,
|
|
76
|
-
fontWeight: "bold",
|
|
77
|
-
},
|
|
78
|
-
modalContainer: {
|
|
79
|
-
flex: 1,
|
|
80
|
-
justifyContent: "center",
|
|
81
|
-
alignItems: "center",
|
|
82
|
-
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
83
|
-
},
|
|
84
|
-
modalContent: {
|
|
85
|
-
width: 300,
|
|
86
|
-
padding: 20,
|
|
87
|
-
backgroundColor: "#fff",
|
|
88
|
-
borderRadius: 10,
|
|
89
|
-
alignItems: "center",
|
|
90
|
-
},
|
|
91
|
-
modalTitle: {
|
|
92
|
-
fontSize: 18,
|
|
93
|
-
fontWeight: "bold",
|
|
94
|
-
marginBottom: 20,
|
|
95
|
-
},
|
|
96
|
-
modalButton: {
|
|
97
|
-
padding: 10,
|
|
98
|
-
backgroundColor: lib_1.colors.light,
|
|
99
|
-
borderRadius: 5,
|
|
100
|
-
marginVertical: 5,
|
|
101
|
-
width: "100%",
|
|
102
|
-
alignItems: "center",
|
|
103
|
-
},
|
|
104
|
-
modalButtonText: {
|
|
105
|
-
color: "#000",
|
|
106
|
-
fontSize: 16,
|
|
107
|
-
},
|
|
108
|
-
modalCloseButton: {
|
|
109
|
-
marginTop: 10,
|
|
110
|
-
padding: 10,
|
|
111
|
-
backgroundColor: "#ccc",
|
|
112
|
-
borderRadius: 5,
|
|
113
|
-
width: "100%",
|
|
114
|
-
alignItems: "center",
|
|
115
|
-
},
|
|
116
|
-
modalCloseButtonText: {
|
|
117
|
-
color: "#000",
|
|
118
|
-
fontSize: 16,
|
|
119
|
-
},
|
|
42
|
+
button: {},
|
|
120
43
|
});
|
|
121
44
|
exports.default = TransBtn;
|
package/dist/component/Tag5s.js
CHANGED
|
@@ -8,8 +8,8 @@ const react_native_1 = require("react-native");
|
|
|
8
8
|
const common_1 = require("@nakamura-123/common");
|
|
9
9
|
const tagFncD_1 = require("../functions/tagFncD");
|
|
10
10
|
const Tag5s = ({ tags }) => {
|
|
11
|
-
|
|
12
|
-
const cntTxt = tags.length
|
|
11
|
+
const { t } = (0, common_1.useDrillTranslation)();
|
|
12
|
+
const cntTxt = t("count.questions", { cnt: tags.length });
|
|
13
13
|
const tagInfos = (0, tagFncD_1.countTagsByLevel)(tags);
|
|
14
14
|
return (<react_native_1.View style={styles.container}>
|
|
15
15
|
<react_native_1.View>
|
|
@@ -9,18 +9,20 @@ const react_redux_1 = require("react-redux");
|
|
|
9
9
|
const common_1 = require("@nakamura-123/common");
|
|
10
10
|
const tagFncD_1 = require("../functions/tagFncD");
|
|
11
11
|
const basicHook_1 = require("../hooks/basicHook");
|
|
12
|
-
const tagFncJ_1 = require("../functions/tagFncJ");
|
|
13
12
|
const TagBadge5s = ({ subject, index }) => {
|
|
14
13
|
// Redux 状態を取得
|
|
15
14
|
const selectKey = (0, react_redux_1.useSelector)((state) => state.app[subject.list][index].key);
|
|
16
15
|
const outOfYearRangeStore = (0, react_redux_1.useSelector)((state) => state.quizCfg.startCfg.outOfYearRange);
|
|
17
16
|
const outOfYearRange = subject.type === "unit" ? outOfYearRangeStore : undefined;
|
|
18
17
|
// Realm データベースクエリ
|
|
19
|
-
const
|
|
18
|
+
const { ops, query } = (0, basicHook_1.useEngineQuery)();
|
|
20
19
|
const tagInfos = () => {
|
|
21
|
-
const getCategoryTags =
|
|
22
|
-
|
|
23
|
-
:
|
|
20
|
+
const getCategoryTags = ops.categoryTagLevels(query, {
|
|
21
|
+
subjectType: subject.type,
|
|
22
|
+
tag: subject.tag,
|
|
23
|
+
key: selectKey,
|
|
24
|
+
outOfYearRange,
|
|
25
|
+
});
|
|
24
26
|
return (0, tagFncD_1.countTagsByLevel)(getCategoryTags);
|
|
25
27
|
};
|
|
26
28
|
return (<react_native_1.View style={styles.container}>
|
|
@@ -34,6 +34,7 @@ const lib_1 = require("@nakamura-123/lib");
|
|
|
34
34
|
const ChartControl_1 = __importDefault(require("./ChartControl"));
|
|
35
35
|
const BarChartContainer = ({ subjectName, TestDB, }) => {
|
|
36
36
|
const dispatch = (0, react_redux_1.useDispatch)();
|
|
37
|
+
const { t } = (0, common_1.useDrillTranslation)();
|
|
37
38
|
const [currentPageIndex, setCurrentPageIndex] = (0, react_1.useState)(0);
|
|
38
39
|
const filteredDB = (0, react_1.useMemo)(() => {
|
|
39
40
|
return TestDB.filtered("subject = $0", subjectName);
|
|
@@ -66,7 +67,7 @@ const BarChartContainer = ({ subjectName, TestDB, }) => {
|
|
|
66
67
|
const handleLeft = () => setCurrentPageIndex(currentPageIndex - 1);
|
|
67
68
|
const handleRight = () => setCurrentPageIndex(currentPageIndex + 1);
|
|
68
69
|
return (<react_native_1.View style={styles.container}>
|
|
69
|
-
<ChartControl_1.default onPressLeft={handleLeft} onPressRight={handleRight} title="
|
|
70
|
+
<ChartControl_1.default onPressLeft={handleLeft} onPressRight={handleRight} title={t("test.chartTitle")} showLeft={currentPageIndex > 0} showRight={currentPageIndex < cnt / 5 - 1}/>
|
|
70
71
|
{/* BarChart を使用 */}
|
|
71
72
|
<common_1.BarChart data={adjustedData} width={barWidth} maxValue={maxValue} toggle={currentPageIndex}/>
|
|
72
73
|
</react_native_1.View>);
|
|
@@ -8,6 +8,7 @@ const react_native_1 = require("react-native");
|
|
|
8
8
|
const common_1 = require("@nakamura-123/common");
|
|
9
9
|
const Square3s = ({ subjectName, TestDB }) => {
|
|
10
10
|
const { t } = (0, common_1.useDrillTranslation)();
|
|
11
|
+
const pawIcon = (0, common_1.usePawIcon)();
|
|
11
12
|
// 回数を数える
|
|
12
13
|
const ThisTestDB = TestDB.filtered("subject == $0", subjectName);
|
|
13
14
|
const challengeCnt = ThisTestDB.length;
|
|
@@ -16,11 +17,11 @@ const Square3s = ({ subjectName, TestDB }) => {
|
|
|
16
17
|
const info = [
|
|
17
18
|
{ cnt: challengeCnt, label: t("test.square3.exam"), icon: "clipboard" },
|
|
18
19
|
{ cnt: successCnt, label: t("test.square3.success"), icon: "check-circle" },
|
|
19
|
-
{ cnt: perfectCnt, label: t("test.square3.perfect"), icon:
|
|
20
|
+
{ cnt: perfectCnt, label: t("test.square3.perfect"), icon: pawIcon },
|
|
20
21
|
];
|
|
21
22
|
return (<react_native_1.View style={styles.container}>
|
|
22
23
|
{info.map((item, index) => {
|
|
23
|
-
return (<common_1.SquareIcon key={index} cnt={item.cnt} cntText="
|
|
24
|
+
return (<common_1.SquareIcon key={index} cnt={item.cnt} cntText={t("count.times")} label={item.label} icon={item.icon}/>);
|
|
24
25
|
})}
|
|
25
26
|
</react_native_1.View>);
|
|
26
27
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ASetting, Store } from "@nakamura-123/types";
|
|
3
|
+
export interface QuizContentsProps {
|
|
4
|
+
navigation: any;
|
|
5
|
+
guideName: keyof Store.GuideType;
|
|
6
|
+
showSwipe1Guide: boolean;
|
|
7
|
+
showSwipe2Guide: boolean;
|
|
8
|
+
isCheck: boolean;
|
|
9
|
+
isResult: boolean;
|
|
10
|
+
isNotInput: boolean;
|
|
11
|
+
isNotQuiz: boolean;
|
|
12
|
+
isInputQuizMode: boolean;
|
|
13
|
+
turn: number;
|
|
14
|
+
}
|
|
15
|
+
export interface EngineComponents {
|
|
16
|
+
QuizContents: React.FC<QuizContentsProps>;
|
|
17
|
+
AllTags: React.FC;
|
|
18
|
+
}
|
|
19
|
+
export declare const engineComponents: Record<ASetting.QuizEngine, EngineComponents>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.engineComponents = void 0;
|
|
7
|
+
const QuizContentsDrill_1 = __importDefault(require("../quiz/QuizContentsDrill"));
|
|
8
|
+
const QuizContentsJLPT_1 = __importDefault(require("../quiz/QuizContentsJLPT"));
|
|
9
|
+
const QuizContentsGrammar_1 = __importDefault(require("../quiz/grammar/QuizContentsGrammar"));
|
|
10
|
+
const AllTags_1 = __importDefault(require("../component/Grade/AllTags"));
|
|
11
|
+
const JAllTags_1 = __importDefault(require("../component/Grade/JAllTags"));
|
|
12
|
+
const GAllTags_1 = __importDefault(require("../component/Grade/GAllTags"));
|
|
13
|
+
// 画面の部品の対応表。関数の対応表(index.ts)と分けて置く。
|
|
14
|
+
// 部品の側から basicHook → engine/index.ts を読むので、1つのファイルにまとめると読み込みが循環する
|
|
15
|
+
exports.engineComponents = {
|
|
16
|
+
drill: { QuizContents: QuizContentsDrill_1.default, AllTags: AllTags_1.default },
|
|
17
|
+
tango: { QuizContents: QuizContentsJLPT_1.default, AllTags: JAllTags_1.default },
|
|
18
|
+
grammar: { QuizContents: QuizContentsGrammar_1.default, AllTags: GAllTags_1.default },
|
|
19
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.drillEngine = void 0;
|
|
4
|
+
const db_1 = require("@nakamura-123/db");
|
|
5
|
+
const lib_1 = require("@nakamura-123/lib");
|
|
6
|
+
const createQuizFncD_1 = require("../functions/createQuizFncD");
|
|
7
|
+
const tagFncD_1 = require("../functions/tagFncD");
|
|
8
|
+
// 過去問(D系)。中身は既存の関数をそのまま呼ぶ
|
|
9
|
+
exports.drillEngine = {
|
|
10
|
+
schema: db_1.DQuestionSchema,
|
|
11
|
+
basicQuizList: (query, startCfg, selected) => (0, createQuizFncD_1.getBasicQuizList)(query, startCfg, selected),
|
|
12
|
+
miniTestQuestions: (query, { subjectType, key, cnt, outOfYearRange }) => (0, createQuizFncD_1.getMiniTestQuestions)(query, subjectType, key, cnt, outOfYearRange),
|
|
13
|
+
testQuestions: (query, { cnt, unit }) => unit ? (0, createQuizFncD_1.getTestQuestionsByUnit)(query, cnt, unit) : (0, createQuizFncD_1.getTestQuestions)(query, cnt),
|
|
14
|
+
lessonTagLevels: (query, selected, outOfYearRange) => (0, tagFncD_1.getSubTagLevelCnts)(query, selected, outOfYearRange),
|
|
15
|
+
// 元の関数は string[] と書いているが、返すのはタグの段階
|
|
16
|
+
subCategoryTagLevels: (query, { subjectType, key, subKey, outOfYearRange }) => (subjectType === "unit"
|
|
17
|
+
? (0, tagFncD_1.getUnitSubTagLevelCnts)(query, key, subKey, outOfYearRange)
|
|
18
|
+
: (0, tagFncD_1.getYearSubTagLevelCnts)(query, key, subKey)),
|
|
19
|
+
categoryTagLevels: (query, { subjectType, key, outOfYearRange }) => (0, tagFncD_1.getCategoryTagLevelCntsD)(query, key, subjectType, outOfYearRange),
|
|
20
|
+
// 年度の円は試験範囲外の年度で絞らない(YearCirclesの今の動き)
|
|
21
|
+
gradeCircleTagLevels: (query, { axis, key, outOfYearRange }) => (0, tagFncD_1.getCategoryTagLevelCntsD)(query, key, axis, axis === "unit" ? outOfYearRange : undefined),
|
|
22
|
+
inQuizOptions: lib_1.inQuizOption.dInQuizOption,
|
|
23
|
+
startOptions: () => lib_1.startOption.dQuizStartOption,
|
|
24
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.grammarEngine = void 0;
|
|
4
|
+
const db_1 = require("@nakamura-123/db");
|
|
5
|
+
const lib_1 = require("@nakamura-123/lib");
|
|
6
|
+
const createQuizFncG_1 = require("../functions/createQuizFncG");
|
|
7
|
+
const tagFncG_1 = require("../functions/tagFncG");
|
|
8
|
+
// 文法(G系、n2b)。単元の画面の章=ミニテストの束(unitId)、小分類=文法(grammarId)。
|
|
9
|
+
// 年度の軸は持たず、成績画面の円は「単元=意味を取る(meaningTag)・年度=穴埋め(blankTag)」に読み替える
|
|
10
|
+
exports.grammarEngine = {
|
|
11
|
+
schema: db_1.GQuestionSchema,
|
|
12
|
+
basicQuizList: (query, startCfg, selected) => (0, createQuizFncG_1.getBasicQuizListG)(query, startCfg, selected),
|
|
13
|
+
miniTestQuestions: (query, { tag, key, cnt }) => (0, createQuizFncG_1.getMiniTestQuestionsG)(query, key, cnt, tag),
|
|
14
|
+
testQuestions: (query, { cnt, tag }) => (0, createQuizFncG_1.getTestQuestionsG)(query, cnt, tag),
|
|
15
|
+
lessonTagLevels: (query, selected) => (0, tagFncG_1.getLessonTagLevelsG)(query, selected),
|
|
16
|
+
subCategoryTagLevels: (query, { tag, subKey }) => (0, tagFncG_1.getGrammarTagLevelsG)(query, subKey, tag),
|
|
17
|
+
categoryTagLevels: (query, { tag, key }) => (0, tagFncG_1.getUnitTagLevelsG)(query, key, tag),
|
|
18
|
+
gradeCircleTagLevels: (query, { axis, key }) => (0, tagFncG_1.getUnitTagLevelsG)(query, key, axis === "unit" ? "meaningTag" : "blankTag"),
|
|
19
|
+
// 問題画面の設定は単語と同じ(文字の大きさ・太さ・ダブルタップ・効果音・音声の音量)
|
|
20
|
+
inQuizOptions: lib_1.inQuizOption.jInQuizOption,
|
|
21
|
+
startOptions: () => lib_1.startOption.gQuizStartOption,
|
|
22
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ASetting } from "@nakamura-123/types";
|
|
2
|
+
import { EngineOps } from "./types";
|
|
3
|
+
export declare const engines: Record<ASetting.QuizEngine, EngineOps>;
|
|
4
|
+
export declare const resolveEngine: (setting: Pick<ASetting.Setting, "appSystem" | "quizEngine"> | undefined) => ASetting.QuizEngine;
|
|
5
|
+
export type { EngineOps, QuizList } from "./types";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveEngine = exports.engines = void 0;
|
|
4
|
+
const drill_1 = require("./drill");
|
|
5
|
+
const grammar_1 = require("./grammar");
|
|
6
|
+
const tango_1 = require("./tango");
|
|
7
|
+
// エンジン(出題の仕組み)→ 中身の対応表。画面はここから引き、系統ごとのif文を書かない。
|
|
8
|
+
// 設計は senmu-tools/10_アプリ保守等/03_系統の設計.md
|
|
9
|
+
exports.engines = {
|
|
10
|
+
drill: drill_1.drillEngine,
|
|
11
|
+
tango: tango_1.tangoEngine,
|
|
12
|
+
grammar: grammar_1.grammarEngine,
|
|
13
|
+
};
|
|
14
|
+
// quizEngineを書いていないアプリは appSystem から決める。
|
|
15
|
+
// 単純に「未設定はdrill」にすると、quizEngineを持たないn4tが版上げでdrillに落ちて壊れる
|
|
16
|
+
const resolveEngine = (setting) => { var _a; return (_a = setting === null || setting === void 0 ? void 0 : setting.quizEngine) !== null && _a !== void 0 ? _a : ((setting === null || setting === void 0 ? void 0 : setting.appSystem) === "JLPT" ? "tango" : "drill"); };
|
|
17
|
+
exports.resolveEngine = resolveEngine;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tangoEngine = void 0;
|
|
4
|
+
const db_1 = require("@nakamura-123/db");
|
|
5
|
+
const lib_1 = require("@nakamura-123/lib");
|
|
6
|
+
const createQuizFncJ_1 = require("../functions/createQuizFncJ");
|
|
7
|
+
const tagFncJ_1 = require("../functions/tagFncJ");
|
|
8
|
+
// JLPT単語(J系)。中身は既存の関数をそのまま呼ぶ。
|
|
9
|
+
// J系は年度の軸を持たず、成績画面の円は「単元=たんご(basicTag)・年度=ちょうかい(listenTag)」に読み替えている
|
|
10
|
+
exports.tangoEngine = {
|
|
11
|
+
schema: db_1.JQuestionSchema,
|
|
12
|
+
basicQuizList: (query, startCfg, selected) => (0, createQuizFncJ_1.getBasicQuizListJ)(query, startCfg, selected),
|
|
13
|
+
miniTestQuestions: (query, { tag, key, cnt }) => (0, createQuizFncJ_1.getMiniTestQuestionsJ)(query, key, cnt, tag),
|
|
14
|
+
testQuestions: (query, { cnt, tag }) => (0, createQuizFncJ_1.getTestQuestionsJ)(query, cnt, tag || "basicTag"),
|
|
15
|
+
lessonTagLevels: (query, selected) => (0, tagFncJ_1.getSubTagLevelCntsJ)(query, selected),
|
|
16
|
+
// 元の関数は string[] と書いているが、返すのはタグの段階
|
|
17
|
+
subCategoryTagLevels: (query, { tag, key, subKey }) => (0, tagFncJ_1.getUnitSubTagLevelCntsJ)(query, key, subKey, tag),
|
|
18
|
+
categoryTagLevels: (query, { tag, key }) => (0, tagFncJ_1.getCategoryTagLevelCntsJ)(query, key, tag),
|
|
19
|
+
gradeCircleTagLevels: (query, { axis, key }) => (0, tagFncJ_1.getCategoryTagLevelCntsJ)(query, key, axis === "unit" ? "basicTag" : "listenTag"),
|
|
20
|
+
inQuizOptions: lib_1.inQuizOption.jInQuizOption,
|
|
21
|
+
// 聞く問題(JlptListen)では「日本語を選ぶ」を出さない
|
|
22
|
+
startOptions: (subjectSystem) => {
|
|
23
|
+
const options = lib_1.startOption.jQuizStartOption;
|
|
24
|
+
if (subjectSystem !== "JlptListen")
|
|
25
|
+
return options;
|
|
26
|
+
return options.map((group) => (Object.assign(Object.assign({}, group), { options: group.options.filter((opt) => opt !== "selectJapanese") })));
|
|
27
|
+
},
|
|
28
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import Realm from "realm";
|
|
2
|
+
import { CfgInitial, QuizInitial } from "@nakamura-123/stores";
|
|
3
|
+
import { Db, GStore, JStore, Lib, Store } from "@nakamura-123/types";
|
|
4
|
+
import { inQuizOption, startOption } from "@nakamura-123/lib";
|
|
5
|
+
type StartCfg = CfgInitial["startCfg"];
|
|
6
|
+
type Selected = QuizInitial["selected"];
|
|
7
|
+
type SubjectType = "unit" | "year";
|
|
8
|
+
export type QuizList = Store.DQInStore[] | JStore.JQInStore[] | GStore.GQInStore[];
|
|
9
|
+
export interface EngineOps<Q extends Realm.Results<any> = Realm.Results<any>> {
|
|
10
|
+
schema: Realm.ObjectClass<any>;
|
|
11
|
+
basicQuizList: (query: Q, startCfg: StartCfg, selected: Selected) => QuizList;
|
|
12
|
+
miniTestQuestions: (query: Q, p: {
|
|
13
|
+
subjectType: SubjectType;
|
|
14
|
+
tag?: Db.SubjectTag;
|
|
15
|
+
key: number;
|
|
16
|
+
cnt: number;
|
|
17
|
+
outOfYearRange: number[];
|
|
18
|
+
}) => QuizList;
|
|
19
|
+
testQuestions: (query: Q, p: {
|
|
20
|
+
cnt: number;
|
|
21
|
+
tag?: Db.SubjectTag;
|
|
22
|
+
unit?: number[];
|
|
23
|
+
}) => QuizList;
|
|
24
|
+
lessonTagLevels: (query: Q, selected: Selected, outOfYearRange: number[]) => Lib.LevelNames[];
|
|
25
|
+
subCategoryTagLevels: (query: Q, p: {
|
|
26
|
+
subjectType: SubjectType;
|
|
27
|
+
tag?: Db.SubjectTag;
|
|
28
|
+
key: number;
|
|
29
|
+
subKey: number;
|
|
30
|
+
outOfYearRange?: number[];
|
|
31
|
+
}) => Lib.LevelNames[];
|
|
32
|
+
categoryTagLevels: (query: Q, p: {
|
|
33
|
+
subjectType: SubjectType;
|
|
34
|
+
tag?: Db.SubjectTag;
|
|
35
|
+
key: number;
|
|
36
|
+
outOfYearRange?: number[];
|
|
37
|
+
}) => Lib.LevelNames[];
|
|
38
|
+
gradeCircleTagLevels: (query: Q, p: {
|
|
39
|
+
axis: SubjectType;
|
|
40
|
+
key: number;
|
|
41
|
+
outOfYearRange: number[];
|
|
42
|
+
}) => Lib.LevelNames[];
|
|
43
|
+
inQuizOptions: inQuizOption.InQuizOptions[];
|
|
44
|
+
startOptions: (subjectSystem: Db.SubjectSystem | undefined) => startOption.StartOptions[];
|
|
45
|
+
}
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CfgInitial, QuizInitial } from "@nakamura-123/stores";
|
|
2
|
+
import { Db, GStore } from "@nakamura-123/types";
|
|
3
|
+
import { QRG } from "../types/filterType";
|
|
4
|
+
type StartCfg = CfgInitial["startCfg"];
|
|
5
|
+
type Selected = QuizInitial["selected"];
|
|
6
|
+
export declare const gTagOf: (tag: Db.SubjectTag | undefined) => GStore.GTag;
|
|
7
|
+
export declare const getUnitQuestionsG: (questions: QRG, unitId: number) => QRG;
|
|
8
|
+
export declare const getGrammarQuestionsG: (questions: QRG, grammarId: number) => QRG;
|
|
9
|
+
export declare const getBasicQuizListG: (QuestionDB: QRG, startCfg: StartCfg, selected: Selected) => GStore.GQInStore[];
|
|
10
|
+
export declare const getMiniTestQuestionsG: (QuestionDB: QRG, unitId: number, cnt: number, tag?: Db.SubjectTag) => GStore.GQInStore[];
|
|
11
|
+
export declare const getTestQuestionsG: (QuestionDB: QRG, cnt: number, tag?: Db.SubjectTag) => GStore.GQInStore[];
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTestQuestionsG = exports.getMiniTestQuestionsG = exports.getBasicQuizListG = exports.getGrammarQuestionsG = exports.getUnitQuestionsG = exports.gTagOf = void 0;
|
|
4
|
+
const lib_1 = require("@nakamura-123/lib");
|
|
5
|
+
const questionFormatG_1 = require("./questionFormatG");
|
|
6
|
+
// 画面から来るタグ名は単語と共用の型なので、文法のタグに読み替える
|
|
7
|
+
const gTagOf = (tag) => tag === "blankTag" ? "blankTag" : "meaningTag";
|
|
8
|
+
exports.gTagOf = gTagOf;
|
|
9
|
+
// 章(=ミニテストの束)の問題。unitIdは単元表から起動時に書き込まれる
|
|
10
|
+
const getUnitQuestionsG = (questions, unitId) => questions.filtered("unitId == $0", unitId);
|
|
11
|
+
exports.getUnitQuestionsG = getUnitQuestionsG;
|
|
12
|
+
// 文法1つの問題。単元表の小分類のkeyは文法番号
|
|
13
|
+
const getGrammarQuestionsG = (questions, grammarId) => questions.filtered("grammarId == $0", grammarId);
|
|
14
|
+
exports.getGrammarQuestionsG = getGrammarQuestionsG;
|
|
15
|
+
// 単元の画面から始める問題。小分類(lesson.key)が0なら章全体
|
|
16
|
+
const getBasicQuizListG = (QuestionDB, startCfg, selected) => {
|
|
17
|
+
if (selected.type !== "unit")
|
|
18
|
+
return [];
|
|
19
|
+
const tagName = (0, exports.gTagOf)(selected.tagName);
|
|
20
|
+
const { category, lesson } = selected;
|
|
21
|
+
const range = lesson.key === 0
|
|
22
|
+
? (0, exports.getUnitQuestionsG)(QuestionDB, category)
|
|
23
|
+
: (0, exports.getGrammarQuestionsG)(QuestionDB, lesson.key);
|
|
24
|
+
const questions = range
|
|
25
|
+
.filtered(`${tagName}.level IN $0`, startCfg.tags)
|
|
26
|
+
.sorted("quizId");
|
|
27
|
+
const { quizCnt, isShuffle } = startCfg.option;
|
|
28
|
+
return pick((0, questionFormatG_1.formatQuestionsG)(questions, tagName), quizCnt, isShuffle);
|
|
29
|
+
};
|
|
30
|
+
exports.getBasicQuizListG = getBasicQuizListG;
|
|
31
|
+
// ミニテスト:章の範囲からランダムに cnt 問
|
|
32
|
+
const getMiniTestQuestionsG = (QuestionDB, unitId, cnt, tag) => {
|
|
33
|
+
const questions = (0, exports.getUnitQuestionsG)(QuestionDB, unitId);
|
|
34
|
+
return pick((0, questionFormatG_1.formatQuestionsG)(questions, (0, exports.gTagOf)(tag)), cnt, true);
|
|
35
|
+
};
|
|
36
|
+
exports.getMiniTestQuestionsG = getMiniTestQuestionsG;
|
|
37
|
+
// しけん:全問からランダムに cnt 問
|
|
38
|
+
const getTestQuestionsG = (QuestionDB, cnt, tag) => pick((0, questionFormatG_1.formatQuestionsG)(QuestionDB, (0, exports.gTagOf)(tag)), cnt, true);
|
|
39
|
+
exports.getTestQuestionsG = getTestQuestionsG;
|
|
40
|
+
const pick = (questions, cnt, isShuffle) => (isShuffle ? lib_1.utilFnc.shuffleList(questions) : questions).slice(0, cnt);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ArticleList, QSelected, SubUnitList } from "@nakamura-123/types";
|
|
2
|
+
type NextItem = QSelected.NextItem;
|
|
3
|
+
type Chapter = {
|
|
4
|
+
key: number;
|
|
5
|
+
label: string;
|
|
6
|
+
title: string;
|
|
7
|
+
sub: SubUnitList[];
|
|
8
|
+
};
|
|
9
|
+
export declare const lessonTitleOf: (type: "unit" | "year", chapter: Chapter, sub: SubUnitList) => string;
|
|
10
|
+
export declare const getNextInList: (list: Chapter[], type: "unit" | "year", category: number, key: number) => NextItem | undefined;
|
|
11
|
+
export declare const getNextInLesson: (articleList: ArticleList[], articleContents: Record<string, string>, unitList: Chapter[], chapterKey: number, unitKey: number) => NextItem | undefined;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getNextInLesson = exports.getNextInList = exports.lessonTitleOf = void 0;
|
|
4
|
+
const articleListFnc_1 = require("./articleListFnc");
|
|
5
|
+
// 問題の題名。単元別は「章の番号 小分類」、試験別は「年度 科目」(SubCategoryListと同じ)
|
|
6
|
+
const lessonTitleOf = (type, chapter, sub) => type === "unit"
|
|
7
|
+
? `${chapter.label} ${sub.title}`
|
|
8
|
+
: `${chapter.title} ${sub.title}`;
|
|
9
|
+
exports.lessonTitleOf = lessonTitleOf;
|
|
10
|
+
// 単元別・試験別:同じ章(年度)の次の小分類。章の最後なら無し
|
|
11
|
+
const getNextInList = (list, type, category, key) => {
|
|
12
|
+
var _a;
|
|
13
|
+
const chapter = list.find((c) => c.key === category);
|
|
14
|
+
const index = (_a = chapter === null || chapter === void 0 ? void 0 : chapter.sub.findIndex((s) => s.key === key)) !== null && _a !== void 0 ? _a : -1;
|
|
15
|
+
const sub = index === -1 ? undefined : chapter === null || chapter === void 0 ? void 0 : chapter.sub[index + 1];
|
|
16
|
+
if (!chapter || !sub)
|
|
17
|
+
return undefined;
|
|
18
|
+
return {
|
|
19
|
+
type: "unit",
|
|
20
|
+
via: "list",
|
|
21
|
+
category,
|
|
22
|
+
lesson: Object.assign(Object.assign({}, sub), { title: (0, exports.lessonTitleOf)(type, chapter, sub) }),
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
exports.getNextInList = getNextInList;
|
|
26
|
+
// レッスン:並び(articleList)で今の単元のすぐ後ろ。説明か問題かは並びを見て決める。
|
|
27
|
+
// 本文のない説明は飛ばす。章をまたがない
|
|
28
|
+
const getNextInLesson = (articleList, articleContents, unitList, chapterKey, unitKey) => {
|
|
29
|
+
var _a;
|
|
30
|
+
const entry = articleList.find((a) => a.key === chapterKey);
|
|
31
|
+
const index = (_a = entry === null || entry === void 0 ? void 0 : entry.items.findIndex((item) => item.type === "unit" && item.key === unitKey)) !== null && _a !== void 0 ? _a : -1;
|
|
32
|
+
if (!entry || index === -1)
|
|
33
|
+
return undefined;
|
|
34
|
+
for (const item of entry.items.slice(index + 1)) {
|
|
35
|
+
if (item.type === "heading")
|
|
36
|
+
continue;
|
|
37
|
+
if (item.type === "article") {
|
|
38
|
+
const articleId = (0, articleListFnc_1.getArticleId)(item.key);
|
|
39
|
+
if (!articleContents[articleId])
|
|
40
|
+
continue;
|
|
41
|
+
return { type: "article", chapterKey, articleId, title: item.title };
|
|
42
|
+
}
|
|
43
|
+
const chapter = unitList.find((u) => u.key === chapterKey);
|
|
44
|
+
const sub = chapter === null || chapter === void 0 ? void 0 : chapter.sub.find((s) => s.key === item.key);
|
|
45
|
+
if (!chapter || !sub)
|
|
46
|
+
return undefined;
|
|
47
|
+
return {
|
|
48
|
+
type: "unit",
|
|
49
|
+
via: "lesson",
|
|
50
|
+
category: chapterKey,
|
|
51
|
+
lesson: Object.assign(Object.assign({}, sub), { title: (0, exports.lessonTitleOf)("unit", chapter, sub) }),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
return undefined;
|
|
55
|
+
};
|
|
56
|
+
exports.getNextInLesson = getNextInLesson;
|
|
@@ -4,4 +4,5 @@ import { Store } from "@nakamura-123/types";
|
|
|
4
4
|
type QuestionType = typeof DQuestionSchema.prototype;
|
|
5
5
|
type QR = Results<QuestionType>;
|
|
6
6
|
export declare const formatQuestions: (questions: QR | QuestionType[]) => Store.DQInStore[];
|
|
7
|
+
export declare const shuffleMultiRow: (array: Store.ChoiceType[]) => Store.ChoiceType[];
|
|
7
8
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.formatQuestions = void 0;
|
|
3
|
+
exports.shuffleMultiRow = exports.formatQuestions = void 0;
|
|
4
4
|
const lib_1 = require("@nakamura-123/lib");
|
|
5
5
|
// OO_メインの出力
|
|
6
6
|
const formatQuestions = (questions) => {
|
|
@@ -71,16 +71,17 @@ const getMultiChoice = (choices) => {
|
|
|
71
71
|
num: index + 1,
|
|
72
72
|
isCorrect: index === 0,
|
|
73
73
|
})));
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
return
|
|
84
|
-
}
|
|
85
|
-
return
|
|
74
|
+
return formattedChoices.map(exports.shuffleMultiRow);
|
|
75
|
+
};
|
|
76
|
+
// multiの1行分の選択肢をシャッフルする。渡した配列は書き換えない(やり直しではstoreの凍結された配列が来る)
|
|
77
|
+
const shuffleMultiRow = (array) => {
|
|
78
|
+
// 「○適当」のように記号の後に文字が続く選択肢もあるため、先頭の記号で判定する
|
|
79
|
+
const markOrder = (choice) => MARU_BATSU_ORDER.findIndex((mark) => choice.startsWith(mark));
|
|
80
|
+
const isMaruBatsu = array.length >= 2 && array.every(({ choice }) => markOrder(choice) !== -1);
|
|
81
|
+
// ○△×の問題は記号の順に固定する
|
|
82
|
+
if (isMaruBatsu) {
|
|
83
|
+
return [...array].sort((a, b) => markOrder(a.choice) - markOrder(b.choice));
|
|
84
|
+
}
|
|
85
|
+
return lib_1.utilFnc.shuffleList([...array]);
|
|
86
86
|
};
|
|
87
|
+
exports.shuffleMultiRow = shuffleMultiRow;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { GQuestionSchema } from "@nakamura-123/db";
|
|
2
|
+
import { GStore } from "@nakamura-123/types";
|
|
3
|
+
import { QRG } from "../types/filterType";
|
|
4
|
+
type QuestionType = typeof GQuestionSchema.prototype;
|
|
5
|
+
export declare const formOfTag: (tagName: GStore.GTag) => GStore.GForm;
|
|
6
|
+
export declare const formatQuestionsG: (questions: QRG | QuestionType[], tagName: GStore.GTag) => GStore.GQInStore[];
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatQuestionsG = exports.formOfTag = void 0;
|
|
4
|
+
const lib_1 = require("@nakamura-123/lib");
|
|
5
|
+
// タグの種類で形式が決まる(J系の basicTag・listenTag と同じ考え方)
|
|
6
|
+
const formOfTag = (tagName) => tagName === "blankTag" ? "blank" : "meaning";
|
|
7
|
+
exports.formOfTag = formOfTag;
|
|
8
|
+
const formatQuestionsG = (questions, tagName) => {
|
|
9
|
+
const form = (0, exports.formOfTag)(tagName);
|
|
10
|
+
return questions.map((Q) => ({
|
|
11
|
+
system: "grammar",
|
|
12
|
+
quizId: Q.quizId,
|
|
13
|
+
form,
|
|
14
|
+
grammarId: Q.grammarId,
|
|
15
|
+
grammar: Q.grammar,
|
|
16
|
+
sentence: Q.sentence,
|
|
17
|
+
choices: form === "blank" ? getShuffledChoices(Array.from(Q.choices)) : [],
|
|
18
|
+
selectedIndexes: [],
|
|
19
|
+
isCorrected: undefined,
|
|
20
|
+
tagName,
|
|
21
|
+
tag: Q[tagName].level,
|
|
22
|
+
startTag: Q[tagName].level,
|
|
23
|
+
}));
|
|
24
|
+
};
|
|
25
|
+
exports.formatQuestionsG = formatQuestionsG;
|
|
26
|
+
// 4択は先頭が正解。出すたびに並びを混ぜる
|
|
27
|
+
const getShuffledChoices = (choices) => lib_1.utilFnc.shuffleList(choices.map((choice, index) => ({
|
|
28
|
+
choice,
|
|
29
|
+
num: index + 1,
|
|
30
|
+
isCorrect: index === 0,
|
|
31
|
+
})));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const toRetryQuizList: (quizList: any[], onlyWrong: boolean) => any[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toRetryQuizList = void 0;
|
|
4
|
+
const lib_1 = require("@nakamura-123/lib");
|
|
5
|
+
const questionFormatD_1 = require("./questionFormatD");
|
|
6
|
+
// 結果画面からのやり直しで出す問題を作る。問題の順は保ち、答えの記録を消す。
|
|
7
|
+
// タグは今の段階から動く(文法は解き始めの段階を今の段階に置き直す)。
|
|
8
|
+
// 選択肢は、位置で答えを覚えないように混ぜ直す。
|
|
9
|
+
// shuffleListは渡した配列を書き換え、storeの配列は凍結されているので写しを渡す
|
|
10
|
+
const toRetryQuizList = (quizList, onlyWrong) => quizList
|
|
11
|
+
.filter((q) => !onlyWrong || q.isCorrected !== true)
|
|
12
|
+
.map((q) => (Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, q), { isCorrected: undefined }), ("selectedIndexes" in q ? { selectedIndexes: [] } : {})), (q.choices ? { choices: lib_1.utilFnc.shuffleList([...q.choices]) } : {})), (q.multiSel ? { multiSel: q.multiSel.map(questionFormatD_1.shuffleMultiRow) } : {})), (q.system === "grammar" ? { startTag: q.tag } : {}))));
|
|
13
|
+
exports.toRetryQuizList = toRetryQuizList;
|