From 9b41f34714e9c8fb33950848f1e6c821875822b2 Mon Sep 17 00:00:00 2001 From: davidpborromeo Date: Thu, 21 Jun 2018 09:29:30 +0900 Subject: [PATCH 1/4] #50 add comment to quiz format --- app/config/quizFormat.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/config/quizFormat.js b/app/config/quizFormat.js index 9e898c6..1b7697a 100644 --- a/app/config/quizFormat.js +++ b/app/config/quizFormat.js @@ -16,39 +16,39 @@ export const pointsList = { //types:['english_moji','audio_english','fill','arrange'], //types:['kanji_moji','kanji_fill','kanji_english','audio_kanji','moji_kanji'], export const studyType = { - hiragana:{ + hiragana:{ // for hiragana and katakana romaji_moji:'HQ1', moji_romaji:'HQ2', audio_moji:'HQ3', }, - initial:{ + initial:{ // for number and aisatsu english_moji:'IQ1', audio_english:'IQ2', audio_moji:'IQ3' }, - vocabulary:{ + vocabulary:{ // topic 1 to 8 english_moji:'GQ1', english_fill:'GQ2', audio_english:'GQ3', audio_fill:'GQ4' }, - grammar:{ + grammar:{ // topic 1 to 8 english_moji:'BQ1', audio_english:'BQ2', fill:'BQ3', arrange:'BQ4', }, - kanji:{ + kanji:{ // topic 1 to 8 kanji_moji:'KQ1', kanji_fill:'KQ2', kanji_english:'KQ3', audio_kanji:'KQ4', moji_kanji:'KQ5', }, - listening:{ + listening:{ // topic 1 to 8 audio_moji:'LQ1', }, - reading:{ + reading:{ // topic 1 to 8 moji:'RQ1', } }; \ No newline at end of file From e7127c477600e8356f51f2e42685b48b7a6b0526 Mon Sep 17 00:00:00 2001 From: davidpborromeo Date: Thu, 21 Jun 2018 20:22:13 +0900 Subject: [PATCH 2/4] #50 fix bug in test --- app/actions/study.js | 28 +--------- app/config/quiz/initials.js | 99 +++++++++++++++++++++++++++++++++++ app/config/quiz/topic1.js | 6 +-- app/screens/Quiz/quizFlash.js | 40 ++++++++++---- app/screens/Study/score.js | 7 +-- 5 files changed, 135 insertions(+), 45 deletions(-) diff --git a/app/actions/study.js b/app/actions/study.js index 33e6be9..b585d67 100644 --- a/app/actions/study.js +++ b/app/actions/study.js @@ -35,6 +35,7 @@ export function endLearn(postValue){ body: JSON.stringify(postValue) }).then(data => data.json()) .then(json => { + console.log(json); dispatch(endLearnDispatch(postValue, json)) }) .catch(err => dispatch(endLearnFailedDispatch(err))) @@ -47,33 +48,6 @@ export function takeQuiz(studyData){ }; } -// export function getMistakes(topicId){ -// return (dispatch) => { -// getJWT().then( JWT => { -// fetch('https://e-learning-backend.herokuapp.com/api/v1/mistakes?' + topicId -// ,{ -// method: 'GET', -// headers: { -// 'Authorization' : JWT, -// 'Accept': 'application/json', -// 'Content-Type': 'application/json', -// }, -// }).then(data => data.json()) -// .then(json => { -// if(type == 'QUIZ'){ -// dispatch(summaryRecordQuizDispatch(json, type)) -// }else{ -// dispatch(summaryRecordTestDispatch(json, type)) -// } -// }) -// .catch(err => dispatch(failedSummary(err))) -// }) -// }; - - -// } - - // ===================================== ACTION SENDING DATA TO REDUCER ================================================= export function startLearnDispatch(studyType, startLearn, studyID, quizSize) { return { diff --git a/app/config/quiz/initials.js b/app/config/quiz/initials.js index a927ecf..d8de24c 100644 --- a/app/config/quiz/initials.js +++ b/app/config/quiz/initials.js @@ -1,6 +1,7 @@ export const numbers = [ { "id":"num_1", + "type":"vocabulary", "english":"0", "moji":"ぜろ", "romaji":"zero", @@ -8,6 +9,7 @@ export const numbers = [ }, { "id":"num_2", + "type":"vocabulary", "english":"1", "moji":"いち", "romaji":"ichi", @@ -15,6 +17,7 @@ export const numbers = [ }, { "id":"num_3", + "type":"vocabulary", "english":"2", "moji":"に", "romaji":"ni", @@ -22,6 +25,7 @@ export const numbers = [ }, { "id":"num_4", + "type":"vocabulary", "english":"3", "moji":"さん", "romaji":"san", @@ -29,6 +33,7 @@ export const numbers = [ }, { "id":"num_5", + "type":"vocabulary", "english":"4", "moji":"よん/し", "romaji":"yon/shi", @@ -36,6 +41,7 @@ export const numbers = [ }, { "id":"num_6", + "type":"vocabulary", "english":"5", "moji":"ご", "romaji":"go", @@ -43,6 +49,7 @@ export const numbers = [ }, { "id":"num_7", + "type":"vocabulary", "english":"6", "moji":"ろく", "romaji":"roku", @@ -50,6 +57,7 @@ export const numbers = [ }, { "id":"num_8", + "type":"vocabulary", "english":"7", "moji":"なな/しち", "romaji":"nana/shichi", @@ -57,6 +65,7 @@ export const numbers = [ }, { "id":"num_9", + "type":"vocabulary", "english":"8", "moji":"はち", "romaji":"hachi", @@ -64,6 +73,7 @@ export const numbers = [ }, { "id":"num_10", + "type":"vocabulary", "english":"9", "moji":"きゅう/く", "romaji":"kyuu/ku", @@ -71,6 +81,7 @@ export const numbers = [ }, { "id":"num_11", + "type":"vocabulary", "english":"10", "moji":"じゅう", "romaji":"juu", @@ -78,6 +89,7 @@ export const numbers = [ }, { "id":"num_12", + "type":"vocabulary", "english":"11", "moji":"じゅういち", "romaji":"juuichi", @@ -85,6 +97,7 @@ export const numbers = [ }, { "id":"num_13", + "type":"vocabulary", "english":"12", "moji":"じゅうに", "romaji":"juuni", @@ -92,6 +105,7 @@ export const numbers = [ }, { "id":"num_14", + "type":"vocabulary", "english":"13", "moji":"じゅうさん", "romaji":"juusan", @@ -99,6 +113,7 @@ export const numbers = [ }, { "id":"num_15", + "type":"vocabulary", "english":"14", "moji":"じゅうよん/じゅうし", "romaji":"juuyon/juushi", @@ -106,6 +121,7 @@ export const numbers = [ }, { "id":"num_16", + "type":"vocabulary", "english":"15", "moji":"じゅうご", "romaji":"juugo", @@ -113,6 +129,7 @@ export const numbers = [ }, { "id":"num_17", + "type":"vocabulary", "english":"16", "moji":"じゅうろく", "romaji":"juuroku", @@ -120,6 +137,7 @@ export const numbers = [ }, { "id":"num_18", + "type":"vocabulary", "english":"17", "moji":"じゅうなな/じゅうしち", "romaji":"juunana/juushichi", @@ -127,6 +145,7 @@ export const numbers = [ }, { "id":"num_19", + "type":"vocabulary", "english":"18", "moji":"じゅうはち", "romaji":"juuhachi", @@ -134,6 +153,7 @@ export const numbers = [ }, { "id":"num_20", + "type":"vocabulary", "english":"19", "moji":"じゅうきゅう/じゅうく", "romaji":"juukyuu/juuku", @@ -141,6 +161,7 @@ export const numbers = [ }, { "id":"num_21", + "type":"vocabulary", "english":"20", "moji":"にじゅう", "romaji":"nijuu", @@ -148,6 +169,7 @@ export const numbers = [ }, { "id":"num_22", + "type":"vocabulary", "english":"30", "moji":"さんじゅう", "romaji":"sanjuu", @@ -155,6 +177,7 @@ export const numbers = [ }, { "id":"num_23", + "type":"vocabulary", "english":"40", "moji":"よんじゅう", "romaji":"yonjuu", @@ -162,6 +185,7 @@ export const numbers = [ }, { "id":"num_24", + "type":"vocabulary", "english":"50", "moji":"ごじゅう", "romaji":"gojuu", @@ -169,6 +193,7 @@ export const numbers = [ }, { "id":"num_25", + "type":"vocabulary", "english":"60", "moji":"ろくじゅう", "romaji":"rokujuu", @@ -176,6 +201,7 @@ export const numbers = [ }, { "id":"num_26", + "type":"vocabulary", "english":"70", "moji":"ななじゅう", "romaji":"nanajuu", @@ -183,6 +209,7 @@ export const numbers = [ }, { "id":"num_27", + "type":"vocabulary", "english":"80", "moji":"はちじゅう", "romaji":"hachijuu", @@ -190,6 +217,7 @@ export const numbers = [ }, { "id":"num_28", + "type":"vocabulary", "english":"90", "moji":"きゅうじゅう", "romaji":"kyuujuu", @@ -197,6 +225,7 @@ export const numbers = [ }, { "id":"num_29", + "type":"vocabulary", "english":"100", "moji":"ひゃく", "romaji":"hyaku", @@ -204,6 +233,7 @@ export const numbers = [ }, { "id":"num_30", + "type":"vocabulary", "english":"200", "moji":"にひゃく", "romaji":"nihyaku", @@ -211,6 +241,7 @@ export const numbers = [ }, { "id":"num_31", + "type":"vocabulary", "english":"300", "moji":"さんびゃく", "romaji":"sanbyaku", @@ -218,6 +249,7 @@ export const numbers = [ }, { "id":"num_32", + "type":"vocabulary", "english":"400", "moji":"よんひゃく", "romaji":"yonhyaku", @@ -225,6 +257,7 @@ export const numbers = [ }, { "id":"num_33", + "type":"vocabulary", "english":"500", "moji":"ごひゃく", "romaji":"gohyaku", @@ -232,6 +265,7 @@ export const numbers = [ }, { "id":"num_34", + "type":"vocabulary", "english":"600", "moji":"ろっぴゃく", "romaji":"roppyaku", @@ -239,6 +273,7 @@ export const numbers = [ }, { "id":"num_35", + "type":"vocabulary", "english":"700", "moji":"ななひゃく", "romaji":"nanahyaku", @@ -246,6 +281,7 @@ export const numbers = [ }, { "id":"num_36", + "type":"vocabulary", "english":"800", "moji":"はっぴゃく", "romaji":"happyaku", @@ -253,6 +289,7 @@ export const numbers = [ }, { "id":"num_37", + "type":"vocabulary", "english":"900", "moji":"きゅうひゃく", "romaji":"kyuuhyaku", @@ -260,6 +297,7 @@ export const numbers = [ }, { "id":"num_38", + "type":"vocabulary", "english":"1000", "moji":"せん", "romaji":"sen", @@ -267,6 +305,7 @@ export const numbers = [ }, { "id":"num_39", + "type":"vocabulary", "english":"2000", "moji":"にせん", "romaji":"nisen", @@ -274,6 +313,7 @@ export const numbers = [ }, { "id":"num_40", + "type":"vocabulary", "english":"3000", "moji":"さんぜん", "romaji":"sanzen", @@ -281,6 +321,7 @@ export const numbers = [ }, { "id":"num_41", + "type":"vocabulary", "english":"4000", "moji":"よんせん", "romaji":"yonsen", @@ -288,6 +329,7 @@ export const numbers = [ }, { "id":"num_42", + "type":"vocabulary", "english":"5000", "moji":"ごせん", "romaji":"gosen", @@ -295,6 +337,7 @@ export const numbers = [ }, { "id":"num_43", + "type":"vocabulary", "english":"6000", "moji":"ろくせん", "romaji":"rokusen", @@ -302,6 +345,7 @@ export const numbers = [ }, { "id":"num_44", + "type":"vocabulary", "english":"7000", "moji":"ななせん", "romaji":"nanasen", @@ -309,6 +353,7 @@ export const numbers = [ }, { "id":"num_45", + "type":"vocabulary", "english":"8000", "moji":"はっせん", "romaji":"hassen", @@ -316,6 +361,7 @@ export const numbers = [ }, { "id":"num_46", + "type":"vocabulary", "english":"9000", "moji":"きゅうせん", "romaji":"kyuusen", @@ -323,6 +369,7 @@ export const numbers = [ }, { "id":"num_47", + "type":"vocabulary", "english":"10,000", "moji":"いちまん", "romaji":"ichiman", @@ -330,6 +377,7 @@ export const numbers = [ }, { "id":"num_48", + "type":"vocabulary", "english":"100,000", "moji":"じゅうまん", "romaji":"juuman", @@ -337,6 +385,7 @@ export const numbers = [ }, { "id":"num_49", + "type":"vocabulary", "english":"1,000,000", "moji":"ひゃくまん", "romaji":"hyakuman", @@ -344,6 +393,7 @@ export const numbers = [ }, { "id":"num_50", + "type":"vocabulary", "english":"1", "moji":"ひとつ", "romaji":"hitotsu", @@ -351,6 +401,7 @@ export const numbers = [ }, { "id":"num_51", + "type":"vocabulary", "english":"2", "moji":"ふたつ", "romaji":"futatsu", @@ -358,6 +409,7 @@ export const numbers = [ }, { "id":"num_52", + "type":"vocabulary", "english":"3", "moji":"みっつ", "romaji":"mittsu", @@ -365,6 +417,7 @@ export const numbers = [ }, { "id":"num_53", + "type":"vocabulary", "english":"4", "moji":"よっつ", "romaji":"yottsu", @@ -372,6 +425,7 @@ export const numbers = [ }, { "id":"num_54", + "type":"vocabulary", "english":"5", "moji":"いつつ", "romaji":"itsutsu", @@ -379,6 +433,7 @@ export const numbers = [ }, { "id":"num_55", + "type":"vocabulary", "english":"6", "moji":"むっつ", "romaji":"muttsu", @@ -386,6 +441,7 @@ export const numbers = [ }, { "id":"num_56", + "type":"vocabulary", "english":"7", "moji":"ななつ", "romaji":"nanatsu", @@ -393,6 +449,7 @@ export const numbers = [ }, { "id":"num_57", + "type":"vocabulary", "english":"8", "moji":"やっつ", "romaji":"yattsu", @@ -400,6 +457,7 @@ export const numbers = [ }, { "id":"num_58", + "type":"vocabulary", "english":"9", "moji":"ここのつ", "romaji":"kokonotsu", @@ -407,6 +465,7 @@ export const numbers = [ }, { "id":"num_59", + "type":"vocabulary", "english":"10", "moji":"とお", "romaji":"too", @@ -414,6 +473,7 @@ export const numbers = [ }, { "id":"num_60", + "type":"vocabulary", "english":"1 piece", "moji":"いっこ", "romaji":"ikko", @@ -421,6 +481,7 @@ export const numbers = [ }, { "id":"num_61", + "type":"vocabulary", "english":"2 pieces", "moji":"にこ", "romaji":"niko", @@ -428,6 +489,7 @@ export const numbers = [ }, { "id":"num_62", + "type":"vocabulary", "english":"3 pieces", "moji":"さんこ", "romaji":"sanko", @@ -435,6 +497,7 @@ export const numbers = [ }, { "id":"num_63", + "type":"vocabulary", "english":"4 pieces", "moji":"よんこ", "romaji":"yonko", @@ -442,6 +505,7 @@ export const numbers = [ }, { "id":"num_64", + "type":"vocabulary", "english":"5 pieces", "moji":"ごこ", "romaji":"goko", @@ -449,6 +513,7 @@ export const numbers = [ }, { "id":"num_65", + "type":"vocabulary", "english":"6 pieces", "moji":"ろっこ", "romaji":"rokko", @@ -456,6 +521,7 @@ export const numbers = [ }, { "id":"num_66", + "type":"vocabulary", "english":"7 pieces", "moji":"ななこ", "romaji":"nanako", @@ -463,6 +529,7 @@ export const numbers = [ }, { "id":"num_67", + "type":"vocabulary", "english":"8 pieces", "moji":"はっこ", "romaji":"hakko", @@ -470,6 +537,7 @@ export const numbers = [ }, { "id":"num_68", + "type":"vocabulary", "english":"9 pieces", "moji":"きゅうこ", "romaji":"kyuuko", @@ -477,6 +545,7 @@ export const numbers = [ }, { "id":"num_69", + "type":"vocabulary", "english":"10 pieces", "moji":"じゅっこ", "romaji":"jukko", @@ -484,6 +553,7 @@ export const numbers = [ }, { "id":"num_70", + "type":"vocabulary", "english":"1 person", "moji":"ひとり", "romaji":"hitori", @@ -491,6 +561,7 @@ export const numbers = [ }, { "id":"num_71", + "type":"vocabulary", "english":"2 persons", "moji":"ふたり", "romaji":"futari", @@ -498,6 +569,7 @@ export const numbers = [ }, { "id":"num_72", + "type":"vocabulary", "english":"3 persons", "moji":"さんにん", "romaji":"sannin", @@ -505,6 +577,7 @@ export const numbers = [ }, { "id":"num_73", + "type":"vocabulary", "english":"4 persons", "moji":"よにん", "romaji":"yonin", @@ -512,6 +585,7 @@ export const numbers = [ }, { "id":"num_74", + "type":"vocabulary", "english":"5 persons", "moji":"ごにん", "romaji":"gonin", @@ -519,6 +593,7 @@ export const numbers = [ }, { "id":"num_75", + "type":"vocabulary", "english":"6 persons", "moji":"ろくにん", "romaji":"rokunin", @@ -526,6 +601,7 @@ export const numbers = [ }, { "id":"num_76", + "type":"vocabulary", "english":"7 persons", "moji":"ななにん", "romaji":"nananin", @@ -533,6 +609,7 @@ export const numbers = [ }, { "id":"num_77", + "type":"vocabulary", "english":"8 persons", "moji":"はちにん", "romaji":"hachinin", @@ -540,6 +617,7 @@ export const numbers = [ }, { "id":"num_78", + "type":"vocabulary", "english":"9 persons", "moji":"きゅうにん", "romaji":"kyuunin", @@ -547,6 +625,7 @@ export const numbers = [ }, { "id":"num_79", + "type":"vocabulary", "english":"10 persons", "moji":"じゅうにん", "romaji":"juunin", @@ -554,6 +633,7 @@ export const numbers = [ }, { "id":"num_80", + "type":"vocabulary", "english":"1", "moji":"いっぽん", "romaji":"ippon", @@ -561,6 +641,7 @@ export const numbers = [ }, { "id":"num_81", + "type":"vocabulary", "english":"2", "moji":"にほん", "romaji":"nihon", @@ -568,6 +649,7 @@ export const numbers = [ }, { "id":"num_82", + "type":"vocabulary", "english":"3", "moji":"さんぼん", "romaji":"sanbon", @@ -575,6 +657,7 @@ export const numbers = [ }, { "id":"num_83", + "type":"vocabulary", "english":"4", "moji":"よんほん", "romaji":"yonhon", @@ -582,6 +665,7 @@ export const numbers = [ }, { "id":"num_84", + "type":"vocabulary", "english":"5", "moji":"ごほん", "romaji":"gohon", @@ -589,6 +673,7 @@ export const numbers = [ }, { "id":"num_85", + "type":"vocabulary", "english":"6", "moji":"ろっぽん", "romaji":"roppon", @@ -596,6 +681,7 @@ export const numbers = [ }, { "id":"num_86", + "type":"vocabulary", "english":"7", "moji":"ななほん", "romaji":"nanahon", @@ -603,6 +689,7 @@ export const numbers = [ }, { "id":"num_87", + "type":"vocabulary", "english":"8", "moji":"はっぽん", "romaji":"happon", @@ -610,6 +697,7 @@ export const numbers = [ }, { "id":"num_88", + "type":"vocabulary", "english":"9", "moji":"きゅうほん", "romaji":"kyuuhon", @@ -617,6 +705,7 @@ export const numbers = [ }, { "id":"num_89", + "type":"vocabulary", "english":"10", "moji":"じゅっぽん", "romaji":"juppon", @@ -624,6 +713,7 @@ export const numbers = [ }, { "id":"num_90", + "type":"vocabulary", "english":"1", "moji":"いちまい", "romaji":"ichimai", @@ -631,6 +721,7 @@ export const numbers = [ }, { "id":"num_91", + "type":"vocabulary", "english":"2", "moji":"にまい", "romaji":"nimai", @@ -638,6 +729,7 @@ export const numbers = [ }, { "id":"num_92", + "type":"vocabulary", "english":"3", "moji":"さんまい", "romaji":"sanmai", @@ -645,6 +737,7 @@ export const numbers = [ }, { "id":"num_93", + "type":"vocabulary", "english":"4", "moji":"よんまい", "romaji":"yonmai", @@ -652,6 +745,7 @@ export const numbers = [ }, { "id":"num_94", + "type":"vocabulary", "english":"5", "moji":"ごまい", "romaji":"gomai", @@ -659,6 +753,7 @@ export const numbers = [ }, { "id":"num_95", + "type":"vocabulary", "english":"6", "moji":"ろくまい", "romaji":"rokumai", @@ -666,6 +761,7 @@ export const numbers = [ }, { "id":"num_96", + "type":"vocabulary", "english":"7", "moji":"ななまい", "romaji":"nanamai", @@ -673,6 +769,7 @@ export const numbers = [ }, { "id":"num_97", + "type":"vocabulary", "english":"8", "moji":"はちまい", "romaji":"hachimai", @@ -680,6 +777,7 @@ export const numbers = [ }, { "id":"num_98", + "type":"vocabulary", "english":"9", "moji":"きゅうまい", "romaji":"kyuumai", @@ -687,6 +785,7 @@ export const numbers = [ }, { "id":"num_99", + "type":"vocabulary", "english":"10", "moji":"じゅうまい", "romaji":"juumai", diff --git a/app/config/quiz/topic1.js b/app/config/quiz/topic1.js index a633a7b..713d73e 100644 --- a/app/config/quiz/topic1.js +++ b/app/config/quiz/topic1.js @@ -670,7 +670,7 @@ export const vocabulary = [ "moji":"グエンさん は せんせい じゃありません。", "kanji":"グエンさん は 先生 じゃありません。", "english":"Mr./Ms. Nguyen is not a teacher.", - "audio":"tp1_g_7.mp3" + "audio":"" }, { "id":"tp1_g_8", @@ -1201,12 +1201,12 @@ export const vocabulary = [ "moji":"英語" }, { - "id":"tp1_r_3", + "id":"tp1_r_2", "type":"reading", "moji":"英語とひらがなとカタカナ" }, { - "id":"tp1_r_2", + "id":"tp1_r_3", "type":"reading", "moji":"ひらがなとカタカナと漢字" }, diff --git a/app/screens/Quiz/quizFlash.js b/app/screens/Quiz/quizFlash.js index 6832718..328146c 100644 --- a/app/screens/Quiz/quizFlash.js +++ b/app/screens/Quiz/quizFlash.js @@ -133,8 +133,8 @@ import { this.fukushuItemCount = { vocabulary: 20, - kanji: 20, - grammar: 10 + kanji: 10, + grammar: 20 } this.state = this.initialState; @@ -519,7 +519,21 @@ import { quizFormat = 'english_moji'; break; } + } + else if (quizFormat.indexOf('audio') > -1 && this.currentQuestion.audio == ''){ + switch(this.currentQuestion.type){ + case 'kanji': + quizFormat = 'kanji_english'; + break; + + case 'initial': + quizFormat = 'moji_romaji'; + break; + default: + quizFormat = 'english_moji'; + break; + } } switch (quizFormat) { @@ -730,6 +744,7 @@ import { this.setState(reset); } else{ + console.log('---beforend'); this.setEndQuiz(); const resetAction = NavigationActions.reset({ @@ -758,22 +773,25 @@ import { setSentParamStart = (index, categoryId, type ) =>{ var startTime = ( new Date().getTime() / 1000); + var reduxType = 'QUIZ'; + console.log(type, type == 'Test'); + if(type == 'Test'){ - var reduxType = "TEST"; + reduxType = "TEST"; } - if(type == 'FUKUSHU'){ - var reduxType = "FUKUSHU"; - } - else{ - var reduxType = "QUIZ"; + else if(type == 'FUKUSHU'){ + reduxType = "FUKUSHU"; } + var value = { type : reduxType, topicId : StudyList[index].topic_id, startTime : startTime, categoryId : StudyList[index].topic_id + categoryId, studyId : StudyList[index].topic_id + categoryId - } + } + + console.log(value, 'yooo'); return value; } @@ -814,7 +832,9 @@ import { var parseValue = this.reduxParam; parseValue['finishTime'] = endTime; - parseValue['questions'] = this.studyRecord; + parseValue['questions'] = this.studyRecord; + + console.log('--end--', parseValue); this.props.endLearn(parseValue); //call our action }; diff --git a/app/screens/Study/score.js b/app/screens/Study/score.js index 7eee3ba..338cb56 100644 --- a/app/screens/Study/score.js +++ b/app/screens/Study/score.js @@ -61,9 +61,7 @@ import { this.item['formatType'] = initialParams.formatType; this.item['idList'] = initialParams.idList; this.item['oneType'] = initialParams.oneType; - - this.props.getLockRecord(); - + } goToTopicSelection = () => { @@ -107,8 +105,7 @@ import { const resetAction = NavigationActions.reset(nav); - this.props.navigation.dispatch(resetAction); - + this.props.navigation.dispatch(resetAction); } setNav(type, index) { From 796852082f15d3b79d90e73e317a776c764d2d9f Mon Sep 17 00:00:00 2001 From: davidpborromeo Date: Thu, 21 Jun 2018 21:24:15 +0900 Subject: [PATCH 3/4] #50 fix audio in correct answer --- app/component/correct.js | 33 ++++++++++++++++------------- app/component/question.js | 8 ++----- app/screens/Quiz/quizBeforeList.js | 2 +- app/screens/Quiz/quizFlash.js | 34 ++++++++++++++++++------------ app/styles/style.js | 14 ++++++------ 5 files changed, 47 insertions(+), 44 deletions(-) diff --git a/app/component/correct.js b/app/component/correct.js index ce9c12c..84ccba2 100644 --- a/app/component/correct.js +++ b/app/component/correct.js @@ -29,12 +29,12 @@ class CorrectPanel extends Component { } componentWillMount() { - this.loadAudio(); + //this.loadAudio(); } componentDidUpdate(){ - this.loadAudio(); + //this.loadAudio(); } @@ -51,9 +51,11 @@ class CorrectPanel extends Component { { this.props.question.english } - this.playAudio(true) } style={ styles.correctAudio }> - - + {this.props.question.audio != '' && + ( this.loadAudio() } style={ styles.correctAudio }> + + ) + } ); @@ -74,13 +76,13 @@ class CorrectPanel extends Component { ); } - loadAudio(){ + loadAudio(){ this.quizAudio = new Sound(this.props.question.audio, Sound.MAIN_BUNDLE, (error) => { if (error) { console.log('failed to load the sound', error); return; } - + this.playAudio(true); }); } @@ -89,16 +91,17 @@ class CorrectPanel extends Component { playDifferentAudio = this.currentAudio != this.props.question.id && this.props.format == 'audio'; if(playDifferentAudio || forcePlay){ - - this.currentAudio = this.props.question.id; - - this.quizAudio.play((success) => { - if (!success) { - this.quizAudio.reset(); - } + + this.currentAudio = this.props.question.id; + this.quizAudio.stop(() => { + this.quizAudio.play((success) => { + if (!success) { + //this.quizAudio.reset(); + } + }); }); + } - } stripSpace(val){ diff --git a/app/component/question.js b/app/component/question.js index 3ef93ea..54a606e 100644 --- a/app/component/question.js +++ b/app/component/question.js @@ -175,9 +175,8 @@ class QuestionPanel extends Component { if (error) { return; } - this.playAudio() + this.playAudio(); - }); } @@ -195,11 +194,8 @@ class QuestionPanel extends Component { } }); }); - - + } - - } } diff --git a/app/screens/Quiz/quizBeforeList.js b/app/screens/Quiz/quizBeforeList.js index 6bc0c0c..8afc4df 100644 --- a/app/screens/Quiz/quizBeforeList.js +++ b/app/screens/Quiz/quizBeforeList.js @@ -39,7 +39,7 @@ class QuizBeforeScreen extends Component { const { navigation } = this.props; this.param = { - type: navigation.getParam('type',null), + formatType: navigation.getParam('formatType',null), title: navigation.getParam('title',null), studyType: navigation.getParam('studyType',null), img: navigation.getParam('img',null), diff --git a/app/screens/Quiz/quizFlash.js b/app/screens/Quiz/quizFlash.js index 328146c..51c523d 100644 --- a/app/screens/Quiz/quizFlash.js +++ b/app/screens/Quiz/quizFlash.js @@ -184,18 +184,24 @@ import { - + { !this.state.showCorrect ? - () : + ( + + + + + + ) : ( { - if(this.state.type == 'Quiz'){ + if(this.initialParams.formatType == 'Quiz'){ this.setState({ showCorrect:true, }); @@ -888,8 +894,8 @@ import { } this.addScore(isCorrect); - - if(this.state.type == 'Quiz' && this.showCorrect){ + console.log(this.initialParams.formatType, this.showCorrect); + if(this.initialParams.formatType == 'Quiz' && this.showCorrect){ setTimeout(() => { this.setState({ diff --git a/app/styles/style.js b/app/styles/style.js index d8b03af..860dd01 100644 --- a/app/styles/style.js +++ b/app/styles/style.js @@ -544,17 +544,15 @@ module.exports = StyleSheet.create({ width:(window.width/2.5) - 10, }, quizLong:{ - padding:5, + padding:10, width: window.width - 30 }, quizGrammar:{ - padding:5, - paddingLeft:10, - paddingRight:10, + padding:10, width: window.width - 30 }, quizVocab:{ - padding:5, + padding:10, width: window.width - 30 }, quizBtnPress:{ @@ -619,8 +617,8 @@ module.exports = StyleSheet.create({ paddingBottom:20 }, quizAnswerWrapper:{ - position:'relative', - height: window.height - 210, + position:'relative', + height: window.height - 290, }, additionalInfo:{ fontSize:25, @@ -716,7 +714,7 @@ module.exports = StyleSheet.create({ position:'absolute', top:10, right:10, - zIndex:10, + zIndex:20, }, correctVolume:{ color:primaryColor, From fbbd2c39d2d437b42c8d56ccdd8654cb628047eb Mon Sep 17 00:00:00 2001 From: davidpborromeo Date: Thu, 21 Jun 2018 22:23:42 +0900 Subject: [PATCH 4/4] #50 fix styles on some places --- app/config/router.js | 20 ++++++++------- app/screens/Quiz/quizBeforeList.js | 2 +- app/screens/Quiz/quizFlash.js | 3 +-- app/screens/Study/hiraganaList.js | 8 +++--- app/screens/Study/studyList.js | 2 +- app/screens/Study/topiclist.js | 10 ++++---- app/screens/Summary/studySummary.js | 14 +++++----- app/screens/home.js | 6 ++--- app/styles/score.js | 6 +++-- app/styles/study.js | 40 +++++++++++++++++++---------- app/styles/summary.js | 20 +++++++-------- 11 files changed, 73 insertions(+), 58 deletions(-) diff --git a/app/config/router.js b/app/config/router.js index 47aec1c..19c9679 100644 --- a/app/config/router.js +++ b/app/config/router.js @@ -116,32 +116,32 @@ export const AppStack = TabNavigator({ Home: { screen: HomeScreen, navigationOptions: { - tabBarLabel: () => { - return ; + tabBarLabel: ({focused,tintColor}) => { + return ; } } }, Study: { screen: StudyStack, navigationOptions: { - tabBarLabel: () => { - return ; + tabBarLabel: ({focused,tintColor}) => { + return ; } } }, Summary: { screen: SummaryStack, navigationOptions: { - tabBarLabel: () => { - return ; + tabBarLabel: ({focused,tintColor}) => { + return ; } } }, Profile: { screen: ProfileStack, navigationOptions: { - tabBarLabel: () => { - return ; + tabBarLabel: ({focused,tintColor}) => { + return ; } } }, @@ -156,7 +156,9 @@ export const AppStack = TabNavigator({ }, { tabBarPosition: 'bottom', tabBarOptions:{ - style:styles.tabBar + style:styles.tabBar, + activeTintColor: '#fff', + inactiveTintColor: '#0072a7', }, swipeEnabled: false, }); diff --git a/app/screens/Quiz/quizBeforeList.js b/app/screens/Quiz/quizBeforeList.js index 8afc4df..aa78280 100644 --- a/app/screens/Quiz/quizBeforeList.js +++ b/app/screens/Quiz/quizBeforeList.js @@ -58,7 +58,7 @@ class QuizBeforeScreen extends Component { {this.list.map((item, key)=>( - {strings[item.title]} + {strings[item.title]} ))} diff --git a/app/screens/Quiz/quizFlash.js b/app/screens/Quiz/quizFlash.js index 51c523d..b3c8a35 100644 --- a/app/screens/Quiz/quizFlash.js +++ b/app/screens/Quiz/quizFlash.js @@ -184,8 +184,7 @@ import { - - + { !this.state.showCorrect ? ( diff --git a/app/screens/Study/hiraganaList.js b/app/screens/Study/hiraganaList.js index 427a453..99ec7ac 100644 --- a/app/screens/Study/hiraganaList.js +++ b/app/screens/Study/hiraganaList.js @@ -188,14 +188,14 @@ class HiraganaListScreen extends Component { return ( - + { strings[this.state.title] } - + { strings['STUDY_LEARN'] } @@ -205,7 +205,7 @@ class HiraganaListScreen extends Component { - + { strings['STUDY_QUIZ'] } @@ -227,7 +227,7 @@ class HiraganaListScreen extends Component { {this.state.type == 'INITIAL' && ( - + { strings['STUDY_TEST'] } { scoreTest } diff --git a/app/screens/Study/studyList.js b/app/screens/Study/studyList.js index b6c30fa..4300bb1 100644 --- a/app/screens/Study/studyList.js +++ b/app/screens/Study/studyList.js @@ -125,7 +125,7 @@ class StudyListScreen extends Component { { StudyList.map((item, key)=>( - + { /> - + { strings['vocabulary'] } - + { strings['grammar'] } - + { strings['kanji'] } - + { strings['topic_test'] } - + { strings['next_topic'] } diff --git a/app/screens/Summary/studySummary.js b/app/screens/Summary/studySummary.js index ee7e703..d7edefd 100644 --- a/app/screens/Summary/studySummary.js +++ b/app/screens/Summary/studySummary.js @@ -141,9 +141,9 @@ import { - - - + + + @@ -159,8 +159,8 @@ import { - - + + @@ -176,8 +176,8 @@ import { - - + + diff --git a/app/screens/home.js b/app/screens/home.js index af0854b..696002d 100644 --- a/app/screens/home.js +++ b/app/screens/home.js @@ -123,8 +123,8 @@ import { progress={ persenTotal } progressColor={'#43b5e7'} /> - - + + @@ -137,7 +137,7 @@ import { { strings['HOME_SUMMARY'] } - + diff --git a/app/styles/score.js b/app/styles/score.js index b173acb..683e561 100644 --- a/app/styles/score.js +++ b/app/styles/score.js @@ -147,8 +147,7 @@ module.exports = StyleSheet.create({ }, containerHome2 : { position: 'relative', - padding : 20, - + padding : 20 }, containerHomeinside2: { borderWidth: 1, @@ -175,6 +174,9 @@ module.exports = StyleSheet.create({ borderBottomWidth: 1, borderBottomColor: '#ddd', }, + NoBorder : { + borderBottomWidth: 0 + }, HomeIcon : { backgroundColor : '#45b4e7', height: 30, diff --git a/app/styles/study.js b/app/styles/study.js index cc28763..36dbac1 100644 --- a/app/styles/study.js +++ b/app/styles/study.js @@ -6,6 +6,14 @@ var { StyleSheet, } = React; +let englishFont = 'Roboto-Regular'; +let japaneseFont = 'NotoSansJP-Regular'; +let primaryColor = '#45b4e7'; // blue +let secondaryColor = '#d2f9fc'; +let textColor = '#333'; +let textSecondary = '#566d97'; +let grayColor = '#ccc'; + module.exports = StyleSheet.create({ container: { @@ -62,8 +70,8 @@ module.exports = StyleSheet.create({ }, borderBox: { - borderWidth: 2, - borderColor: '#45B5E7', + borderWidth: 1, + borderColor: primaryColor, }, textLg: { @@ -128,9 +136,12 @@ module.exports = StyleSheet.create({ title :{ textAlign: 'center', fontSize: 25, - marginTop: 5, - marginBottom : 5, + paddingTop: 5, + paddingBottom : 5, fontWeight: 'bold', + borderColor: primaryColor, + borderWidth: 1, + borderTopWidth : 0, }, lockButton : { position: 'absolute', @@ -152,9 +163,10 @@ module.exports = StyleSheet.create({ backgroundColor: 'white', }, titleContainer : { - borderColor: '#2771e8', - borderWidth: 1, - borderTopWidth : 0, + + }, + titleListContainer : { + marginBottom:20 }, height40 : { height : 40, @@ -164,11 +176,14 @@ module.exports = StyleSheet.create({ height: 70, justifyContent: 'center', alignItems : 'center', - borderColor: '#2771e8', + borderColor: primaryColor, borderWidth: 1, backgroundColor: '#fff', borderRadius: 5, - marginBottom: 5 + marginBottom: 10, + shadowColor: "#000", + shadowOpacity: 0.5, + elevation: 2 }, btnLearnText : { fontSize:20, @@ -197,8 +212,7 @@ module.exports = StyleSheet.create({ height : 100, paddingTop : 10, paddingBottom : 10, - flexDirection: 'row', - justifyContent: 'space-between', + flexDirection: 'row', }, buttonTopic: { height: 90, @@ -209,7 +223,7 @@ module.exports = StyleSheet.create({ borderColor: '#96d6f7', borderWidth: 1, borderRadius: 5, - + margin:'1%' },buttonTopicText:{ color : '#000000', fontSize : 20, @@ -228,7 +242,7 @@ module.exports = StyleSheet.create({ }, nextTopic: { height: 60, - width : '100%', + width : '98%', backgroundColor: '#cccccc', justifyContent: 'center', alignItems: 'center', diff --git a/app/styles/summary.js b/app/styles/summary.js index b6f8e9f..84b640d 100644 --- a/app/styles/summary.js +++ b/app/styles/summary.js @@ -71,15 +71,12 @@ module.exports = StyleSheet.create({ width: '100%', height: '100%', }, - flexBot1 : { - flex: 1, - padding:8, - + flexBot1 : { + padding:5, + paddingTop:10, }, flexRow: { - flex: 1, - flexDirection: 'row', - height: 130, + }, botButton : { backgroundColor: '#fff', @@ -138,12 +135,13 @@ module.exports = StyleSheet.create({ }, conGraph :{ backgroundColor: '#fff', - width : 90, + width : '100%', height: 120, - borderRadius: 8, + borderRadius: 5, borderWidth: 1, borderColor: '#ddd', - + paddingTop:5, + alignItems: 'center', }, absoluteGr: { position: 'absolute', @@ -154,7 +152,7 @@ module.exports = StyleSheet.create({ justifyContent: 'center', alignItems: 'center', top: 23, - marginLeft: 5, + marginLeft:5 }, btnText : { textAlign: 'center',