diff --git a/app/fixtures/questions.json b/app/fixtures/questions.json
index 2022cb9..5f11ba9 100755
--- a/app/fixtures/questions.json
+++ b/app/fixtures/questions.json
@@ -6,6 +6,7 @@
"answers": [
"true", "false"
],
+ "correctAnswer":"false",
"weight": 2,
"type": "radio"
},
@@ -14,6 +15,7 @@
"answers": [
8, 13, 21, 26, 31
],
+ "correctAnswer":"21",
"weight": 2,
"type": "radio"
},
@@ -22,6 +24,7 @@
"answers": [
"dog", "mouse", "lion", "snake", "elephant"
],
+ "correctAnswer":"snake",
"weight": 4,
"type": "radio"
},
@@ -30,6 +33,7 @@
"answers": [
20, 24, 25, 26, 28
],
+ "correctAnswer":"24",
"weight": 4,
"type": "radio"
},
@@ -38,6 +42,7 @@
"answers": [
3, 7, 8, 15, 30
],
+ "correctAnswer":"8",
"weight": 4,
"type": "radio"
},
@@ -46,6 +51,7 @@
"answers": [
"twig", "tree", "branch", "blossom"
],
+ "correctAnswer":"twig",
"weight": 5,
"type": "radio"
},
@@ -54,6 +60,7 @@
"answers": [
"city", "animal", "ocean", "river", "country"
],
+ "correctAnswer":"ocean",
"weight": 2,
"type": "radio"
},
@@ -62,6 +69,7 @@
"answers": [
2, 5, 10, 25, 50
],
+ "correctAnswer":"10",
"weight": 4,
"type": "radio"
},
@@ -70,12 +78,14 @@
"answers": [
2, 4, 4.5, 5, 6
],
+ "correctAnswer": "5",
"weight": 6,
"type": "radio"
},
{
"question": "Who is the famous personality?",
"imageURL": "http://ia.media-imdb.com/images/M/MV5BMTIwMzAwMzg1MV5BMl5BanBnXkFtZTYwMjc4ODQ2._V1._SX214_CR0,0,214,314_.jpg",
+ "correctAnswer":"Stanley Kubrick",
"weight": 8,
"type": "fillin"
}
diff --git a/app/index.html b/app/index.html
index 99105c6..f0b1b22 100755
--- a/app/index.html
+++ b/app/index.html
@@ -1,16 +1,16 @@
- Quiz
+ {{locale['Quiz']}}
-
-
-
+
diff --git a/app/js/controllers/quizCtrl.js b/app/js/controllers/quizCtrl.js
index dbd2a90..fbd7ed5 100755
--- a/app/js/controllers/quizCtrl.js
+++ b/app/js/controllers/quizCtrl.js
@@ -6,6 +6,8 @@ quizApp.controller('QuizCtrl', function QuizCtrl($rootScope, $scope, $resource,
$scope.quiz = quizModel.initialize(data);
$scope.currentPosition = -1;
+ $scope.user = userModel.initialize($rootScope.userName);
+
if ($scope.quiz.isRandom) {
$scope.quiz.questionnaire = $scope.shuffle($scope.quiz.questionnaire);
}
@@ -26,16 +28,14 @@ quizApp.controller('QuizCtrl', function QuizCtrl($rootScope, $scope, $resource,
$scope.currentQuestion = $scope.quiz.questionnaire[++$scope.currentPosition];
};
- $scope.user = {};
-
$scope.submitAns = function (id) {
var question = $scope.quiz.questionnaire.filter(function (value) {
return value.id === id;
});
- if ($scope.user.response === question.answer) {
+ if ($scope.currentResponse === question[0].answer) {
$scope.user.correct = $scope.user.correct + 1;
- $scope.user.score = $scope.user.score + question.weightage;
+ $scope.user.score = $scope.user.score + question[0].weightage;
}
$scope.next();
};
@@ -46,13 +46,13 @@ quizApp.controller('QuizCtrl', function QuizCtrl($rootScope, $scope, $resource,
};
$scope.isAnswered = function () {
- return ($scope.user.response !== "" && $scope.user.response !== undefined)
+ return ($scope.currentResponse !== "" && $scope.currentResponse !== undefined)
};
$scope.next=function(){
var valid = $scope.hasNext();
if (valid !== true) {
- $scope.user.response = "";
+ $scope.currentResponse = "";
$scope.updatePage();
timerController.restart();
} else {
@@ -67,4 +67,7 @@ quizApp.controller('QuizCtrl', function QuizCtrl($rootScope, $scope, $resource,
$rootScope.userName="";
$location.path('/');
};
+ $scope.back=function(){
+ $location.path('/');
+ };
});
diff --git a/app/js/i18n/de.js b/app/js/i18n/de.js
index 63d0cea..8a7fe43 100644
--- a/app/js/i18n/de.js
+++ b/app/js/i18n/de.js
@@ -1,13 +1,19 @@
{
"locale-id": "de",
"appTitle": "Quiz Anwendung",
- "home-title": "Quiz",
- "home-text": "geben Sie Ihren Namen",
+ "Quiz": "Quiz",
+ "enter-your-name": "Geben Sie Ihren Namen",
"start-quiz": "Quiz starten",
"help": "helfen",
"results":"Ergebnisse",
"congrats":"Herzlichen Glückwunsch!",
"score-msg":"Ihr Ergebnis ist ",
"play-again":"spiele wieder",
- "new-game":"neues Spiel"
+ "new-game":"neues Spiel",
+ "next":"neben",
+ "pass":"gehen",
+ "question":"Frage",
+ "weight":"Gewicht",
+ "quit":"verlassen",
+ "back":"zurück"
}
diff --git a/app/js/i18n/en.js b/app/js/i18n/en.js
index 8bb405f..b714ba0 100644
--- a/app/js/i18n/en.js
+++ b/app/js/i18n/en.js
@@ -1,13 +1,19 @@
{
"locale-id": "en",
"appTitle": "Quiz Application",
- "home-title": "Quiz",
- "home-text": "Enter your name",
+ "Quiz": "Quiz",
+ "enter-your-name": "Enter your name",
"start-quiz": "Start Quiz",
"help": "Help",
"results":"Results",
"congrats":"Congratulations!",
"score-msg":"Your score is",
"play-again":"Play Again",
- "new-game":"New Game"
+ "new-game":"New Game",
+ "next":"Next",
+ "pass":"Pass",
+ "question":"Question",
+ "weight":"Weight",
+ "quit":"Quit" ,
+ "back":"Back"
}
diff --git a/app/js/models/userModel.js b/app/js/models/userModel.js
index b84d7ac..11645ae 100755
--- a/app/js/models/userModel.js
+++ b/app/js/models/userModel.js
@@ -5,7 +5,6 @@ quizApp.factory('userModel', function () {
initialize: function (name) {
var user = {};
user.name = name;
- user.response = "";
user.correct = 0;
user.score = 0;
return user;
diff --git a/app/js/views/templates/helpView.html b/app/js/views/templates/helpView.html
index a6c42e2..8b5c709 100644
--- a/app/js/views/templates/helpView.html
+++ b/app/js/views/templates/helpView.html
@@ -1,10 +1,10 @@
-
-
- - The score obtained at the end of the Quiz is sum of weights of the questions answered correctly
- - All the questions do not have the same weight
- - If you do not answer the question in the time limit the question is passed
- - There are {{quiz.questionnaire.length}} questions
- - Each question has time limit of {{quiz.duration}} seconds
-
-
+
+
+
The score obtained at the end of the Quiz is the sum of weights of the questions answered correctly.
+
There are {{quiz.questionnaire.length}} questions
+
All the questions do not have the same weight.
+
Each question has time limit of {{quiz.duration}} seconds
+
If you do not answer the question in the time limit the question is passed
+
+
diff --git a/app/js/views/templates/homeView.html b/app/js/views/templates/homeView.html
index c217f20..9c683a9 100755
--- a/app/js/views/templates/homeView.html
+++ b/app/js/views/templates/homeView.html
@@ -1,7 +1,7 @@