Merge remote-tracking branch 'origin/lk_candidate' into candidate-area
# Conflicts: # src/App.js # src/components/Footer/footer.scss # src/components/ProfileHeader/ProfileHeader.js # src/pages/AuthForCandidate/authForCandidate.scss
This commit is contained in:
@ -4,14 +4,76 @@ import {apiRequest} from "../api/request";
|
||||
|
||||
|
||||
const initialState = {
|
||||
// questions: [],
|
||||
answer: [],
|
||||
answers: [
|
||||
{
|
||||
"id": "12",
|
||||
"question_id": "7",
|
||||
"answer_body": "Нsdf sfd fds sdf sf sfsdf sdfеск вsdffsdfsdf sf sdf sdfsdfsdfsdfdsjknsdkf dssdjf sdfbsdhf sd hjdsfv sdhjvар1 отв1 истина"
|
||||
},
|
||||
{
|
||||
"id": "23",
|
||||
"question_id": "7",
|
||||
"answer_body": "Неск вар1 отв1 истина"
|
||||
},
|
||||
{
|
||||
"id": "233",
|
||||
"question_id": "7",
|
||||
"answer_body": "lorem sdfdsf dfs sdf "
|
||||
},
|
||||
],
|
||||
questionnaires: [],
|
||||
questions: [
|
||||
{
|
||||
"id": "4",
|
||||
"question_type_id": "3",
|
||||
"question_body": "Для чего в Python используется встроенная функция enumerate()?",
|
||||
"question_priority": null,
|
||||
"next_question": null,
|
||||
"time_limit": "00:22:00"
|
||||
},
|
||||
{
|
||||
"id": "24",
|
||||
"question_type_id": "3",
|
||||
"question_body": "Для чего в Python dfsf троенная функция enumerate()?",
|
||||
"question_priority": null,
|
||||
"next_question": null,
|
||||
"time_limit": "00:22:00"
|
||||
},
|
||||
{
|
||||
"id": "41",
|
||||
"question_type_id": "3",
|
||||
"question_body": "Для чегоsdfsdfя функция enumerate()?",
|
||||
"question_priority": null,
|
||||
"next_question": null,
|
||||
"time_limit": "00:22:00"
|
||||
},
|
||||
{
|
||||
"id": "5",
|
||||
"question_type_id": '2',
|
||||
"question_body": "Один ответ2",
|
||||
"question_priority": null,
|
||||
"next_question": null,
|
||||
"time_limit": "00:22:00"
|
||||
}
|
||||
],
|
||||
selectedTest: {
|
||||
"user_id": 1,
|
||||
"uuid": "d222f858-60fd-47fb-8731-dc9d5fc384c5",
|
||||
"score": 11,
|
||||
"status": 2,
|
||||
"percent_correct_answers": 0.25,
|
||||
"testing_date": "2022-03-17 11:14:22",
|
||||
"questionnaire_title": "Кат1 Анкета 1 активна"
|
||||
},
|
||||
selectedAnswers:{},
|
||||
completedTest: false,
|
||||
result: null,
|
||||
isLoading: false,
|
||||
dataQuestionnairesOfUser: [],
|
||||
passedTests: [],
|
||||
selectedTest: null,
|
||||
userInfo: null
|
||||
|
||||
userInfo: null,
|
||||
|
||||
};
|
||||
export const setUserInfo = createAsyncThunk(
|
||||
'userInfo',
|
||||
@ -47,13 +109,15 @@ export const quizSlice = createSlice({
|
||||
name: 'quiz',
|
||||
initialState,
|
||||
reducers: {
|
||||
setQuestionnairesList: (state, action) => {
|
||||
state.dataQuestionnairesOfUser = action.payload;
|
||||
state.passedTests = action.payload.filter(item => item.status === 2)
|
||||
setQuestionnaires: (state, action) => {
|
||||
state.questionnaires = action.payload;
|
||||
},
|
||||
setSelectedTest: (state, action) => {
|
||||
state.selectedTest = action.payload
|
||||
},
|
||||
setCompleteTest: (state, action) => {
|
||||
state.completedTest = true
|
||||
}
|
||||
},
|
||||
extraReducers: {
|
||||
[setUserInfo.fulfilled]: (state, action) => {
|
||||
@ -68,16 +132,21 @@ export const quizSlice = createSlice({
|
||||
},
|
||||
});
|
||||
|
||||
export const {setQuestionnairesList, setSelectedTest} = quizSlice.actions;
|
||||
export const {setQuestionnaires, setSelectedTest, setCompleteTest} = quizSlice.actions;
|
||||
|
||||
|
||||
export const selectAnswer = (state) => state.quiz.answer;
|
||||
export const selectQuestionnairesOfUser = (state) => state.quiz.dataQuestionnairesOfUser;
|
||||
export const answersSelector = (state) => state.quiz.answers;
|
||||
export const questionnairesSelector = (state) => state.quiz.questionnaires;
|
||||
export const selectedAnswersSelector = (state) => state.quiz.selectedAnswers
|
||||
export const questionsSelector = (state) => state.quiz.questions
|
||||
export const completedTestSelector = (state) => state.quiz.completedTest
|
||||
|
||||
export const selectResult = (state) => state.quiz.result;
|
||||
export const selectedTest = (state) => state.quiz.selectedTest;
|
||||
export const selectPassedTests = (state) => state.quiz.passedTests;
|
||||
export const selectUserInfo = (state) => state.quiz.userInfo;
|
||||
|
||||
|
||||
|
||||
export default quizSlice.reducer;
|
||||
|
||||
|
Reference in New Issue
Block a user