Skip to content
This repository has been archived by the owner on Apr 14, 2020. It is now read-only.

Commit

Permalink
Merge pull request #67 from ZendyLim/feature/#50_goi_quiz
Browse files Browse the repository at this point in the history
#50 minified image and limit questions
  • Loading branch information
viinkelvin authored Jun 4, 2018
2 parents e654993 + d469576 commit 71184eb
Show file tree
Hide file tree
Showing 37 changed files with 69 additions and 54 deletions.
Binary file modified app/assets/img/topic/1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/assets/img/topic/10.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/assets/img/topic/11.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/assets/img/topic/12.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/assets/img/topic/14.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/assets/img/topic/15.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/assets/img/topic/2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/assets/img/topic/3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/assets/img/topic/4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/assets/img/topic/5.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/assets/img/topic/6.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/assets/img/topic/7.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/assets/img/topic/8.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/assets/img/topic/9.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/assets/img/topic/character exp dissapoint.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/assets/img/topic/character exp happy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/assets/img/topic/character exp normal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed app/assets/img/topic/class.jpg
Binary file not shown.
Binary file removed app/assets/img/topic/health.jpg
Binary file not shown.
Binary file modified app/assets/img/topic/image_loading.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/assets/img/topic/image_loading.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed app/assets/img/topic/kotatsu_room.jpg
Binary file not shown.
Binary file removed app/assets/img/topic/market.png
Binary file not shown.
Binary file removed app/assets/img/topic/me_family.jpg
Binary file not shown.
Binary file removed app/assets/img/topic/number_chara.jpg
Binary file not shown.
Binary file removed app/assets/img/topic/office.jpg
Diff not rendered.
Binary file removed app/assets/img/topic/ramen_shop.jpg
Diff not rendered.
Binary file removed app/assets/img/topic/society.jpg
Diff not rendered.
Binary file removed app/assets/img/topic/travel.jpg
Diff not rendered.
2 changes: 1 addition & 1 deletion app/component/answerButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class AnswerButton extends Component {

_renderIcon(){
let iconName = '';
console.log(this.props.isCorrect);

switch (this.props.isCorrect) {
case 1:
iconName = 'circle-o';
Expand Down
2 changes: 1 addition & 1 deletion app/component/fillBlank.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ class FillBlank extends Component {
if(this.emptyBox[i].char) filled[filled.length] = this.emptyBox[i].char;

}
console.log(this.shuffledString.length, 'wee', filled.length);

if(filled.length == this.shuffledString.length){

this.onSelectAnswer(filled.join(''));
Expand Down
2 changes: 1 addition & 1 deletion app/component/fillButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ class FillButton extends Component {
if(this.emptyBox[i].char) filled[filled.length] = this.emptyBox[i].char;

}
console.log(this.shuffledString.length, 'wee', filled.length);

if(filled.length == this.shuffledString.length){

this.onSelectAnswer(filled.join(''));
Expand Down
2 changes: 1 addition & 1 deletion app/component/question.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class QuestionPanel extends Component {
playDifferentAudio = this.currentAudio != this.props.question.id && this.props.format == 'audio';

if(playDifferentAudio || forcePlay){
console.log(this.currentAudio + ' - ' + this.props.question.id);

this.currentAudio = this.props.question.id;

this.quizAudio.play((success) => {
Expand Down
12 changes: 1 addition & 11 deletions app/config/image_list.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
export const ImageData = {
loading : require('../assets/img/topic/image_loading.jpg'),
default_bg : require('../assets/img/topic/class.jpg'),
class : require('../assets/img/topic/class.jpg'),
health : require('../assets/img/topic/health.jpg'),
kotatsu_room : require('../assets/img/topic/kotatsu_room.jpg'),
market : require('../assets/img/topic/market.png'),
me_family : require('../assets/img/topic/me_family.jpg'),
number_chara : require('../assets/img/topic/number_chara.jpg'),
office : require('../assets/img/topic/office.jpg'),
ramen_shop : require('../assets/img/topic/ramen_shop.jpg'),
society : require('../assets/img/topic/society.jpg'),
travel : require('../assets/img/topic/travel.jpg'),
default_bg : require('../assets/img/topic/1.jpg'),
// Character
happy : require('../assets/img/char/char-happy.png'),
sad : require('../assets/img/char/char-sad.png'),
Expand Down
96 changes: 60 additions & 36 deletions app/screens/Quiz/quizFlash.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ import {
this.timerResume = false;
this.time = 6000;


this.state = {
timesUp: false,
expression: 'default',
Expand All @@ -104,8 +105,8 @@ import {
typeQuiz : '',
index : '',
format:'',
showCorrect:false
}
showCorrect:false
}


this._onSetLanguageTo('en');
Expand Down Expand Up @@ -193,10 +194,9 @@ import {
);
}

componentWillMount() {
componentDidMount() {
const { navigation } = this.props;

console.log(this.props.navigation);

this.oneType = navigation.getParam('oneType',null);
this.mounted = true;
idList = navigation.getParam('idList', null);
Expand All @@ -211,7 +211,7 @@ import {
index: navigation.getParam('index', null),
isTopicTest: navigation.getParam('isTopicTest', null)
}
console.log(this.initialParams);

this.setState(this.initialParams);

this.setInitial();
Expand All @@ -232,11 +232,11 @@ import {
}
else{
shuffledQuiz = this.shuffleItems(this.quizItems);
console.log(shuffledQuiz,'a--');
this.allQuestion = shuffledQuiz.map((question) =>
this.shuffleAnswers(question, shuffledQuiz)
);

console.log(this.allQuestion,'s--');
this.currentQuestion = this.allQuestion[0];

this.setState({
Expand Down Expand Up @@ -267,7 +267,7 @@ import {
}

componentWillUnmount(){
this.mounted = false;
this.mounted = false;
}

// set items
Expand Down Expand Up @@ -354,24 +354,29 @@ import {

array.answerOption[i] = randomItem;
}
console.log(array);

return array;
};

// randomized question
shuffleItems(array) {
var currentIndex = array.length, temporaryValue, randomIndex;

shuffleItems(array) {
var currentIndex = array.length, temporaryValue, randomIndex, output = [];
var limit = this.initialParams.type == 'Test' ? 25 : array.length;

while (0 !== currentIndex) {
randomIndex = Math.floor(Math.random() * currentIndex);
currentIndex -= 1;

temporaryValue = array[currentIndex];
array[currentIndex] = array[randomIndex];
array[randomIndex] = temporaryValue;
array[randomIndex] = temporaryValue;
}

return array;

for(i = 0; i < limit; i++){
output[i] = array[i];
}

return output;
};

randomQuizFormat(){
Expand All @@ -385,7 +390,7 @@ import {
quizFormat = this.oneType ? [this.oneType] : this.quizOptions.types;
quizFormatLength = quizFormat.length;
randomIndex = Math.floor(Math.random() * quizFormatLength);
time = this.time;

switch (quizFormat[randomIndex]) {
case 'romaji_moji':
Expand Down Expand Up @@ -440,26 +445,32 @@ import {
paramFormat = {
answerFormat: 'moji',
questionFormat: 'audio',
time: this.state.time * 1.5

};

time = time * 1.5;

break;

case 'english_fill':
paramFormat = {
answerFormat: 'moji',
questionFormat: 'english',
time:this.state.time * 1.5

};

time = time * 1.5;

break;

case 'kanji_fill':
paramFormat = {
answerFormat: 'moji',
questionFormat: 'kanji',
time:this.state.time * 1.5

};

time = time * 1.5;

break;

Expand Down Expand Up @@ -495,18 +506,23 @@ import {
paramFormat = {
answerFormat: 'moji',
questionFormat: 'fill',
time:this.state.time * 1.5
};

};

time = time * 1.5;

break;

case 'arrange':
paramFormat = {
answerFormat: 'moji',
questionFormat: 'arrange',
time:this.state.time * 2
};
break;

};

time = time * 2;

break;

default:
paramFormat = {
Expand All @@ -515,7 +531,10 @@ import {
};
break;
}
paramFormat.time = time;
paramFormat.format = quizFormat[randomIndex];

console.log(paramFormat.time,'time2',this.time);
this.setState(paramFormat);
}

Expand All @@ -542,17 +561,18 @@ import {
timesUp: false,
expression:'default',
correct: 0,
showCorrect:false,
time:this.time
showCorrect:false
});
}
else{
this.setEndQuiz();

this.props.navigation.navigate('ScoreScreen',{
index : this.state.index,
typeQuiz : this.state.type,
studyTitle : this.title
});

}
}

Expand Down Expand Up @@ -601,16 +621,14 @@ import {
var endTime = ( new Date().getTime() / 1000);

var parseValue = this.reduxParam;
console.log(parseValue);

parseValue['finishTime'] = endTime;
parseValue['quizData'] = this.studyRecord;
this.props.endLearn(parseValue); //call our action
};

goNextQuestion() {

this.setNextQuestion();

goNextQuestion() {
this.setNextQuestion();
}

onTimesUp = (val) => {
Expand All @@ -625,7 +643,7 @@ import {
expression:'sad'
});

setTimeout(() => {
setTimeout(() => {
this.setNextQuestion();
}, this.state.pause);
}
Expand All @@ -652,20 +670,26 @@ import {
this.addScore(isCorrect);

if(this.study.type == 'TOPIC' && this.state.type == 'Quiz' && this.showCorrect){
setTimeout(() => {

this.setState({
showCorrect: this.showCorrect
});

stopTimerParam.showCorrect = this.showCorrect;
}, this.state.pause);

}
else{
setTimeout(() => {
this.showCorrect = false;
this.setNextQuestion();

}, this.state.pause);
}, this.state.pause);
}

this.setState(stopTimerParam);


};

addScore = (isCorrect) => {
Expand Down
3 changes: 2 additions & 1 deletion app/screens/Study/topiclist.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ navigateToLearn=(type, categoryId)=>{

param.isTopicTest = true;
param.studyType = this.state.title;

param.type = 'Test';

this.props.navigation.navigate('QuizFlash',(
param
));
Expand Down
4 changes: 2 additions & 2 deletions app/screens/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ class MainScreen extends Component {
// Render any loading content that you like here
render() {
console.log(this.props.data);
if (this.props.data) {
if(this.props.data.userId){
if (true) {
if(true){
return (
<MainStack />
);
Expand Down

0 comments on commit 71184eb

Please sign in to comment.