本文整理汇总了TypeScript中entcore.angular.forEach方法的典型用法代码示例。如果您正苦于以下问题:TypeScript angular.forEach方法的具体用法?TypeScript angular.forEach怎么用?TypeScript angular.forEach使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类entcore.angular
的用法示例。
在下文中一共展示了angular.forEach方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
angular.forEach(grainCopy.grain_copy_data.custom_copy_data.filled_answer_list, function(filled_answer, key){
answerCorrect = false;
angular.forEach(grainScheduled_correct_answer_list, function(correct_answer){
if(!correct_answer.alreadyMatch){
if(CompareStringHelper.compare
(
correct_answer.text,
filled_answer.text
) === true){
answerCorrect = true;
correct_answer.alreadyMatch = true;
}
}
});
if(answerCorrect){
isCorrectReturnArray[key] = true;
if(grainScheduled.grain_data.custom_data.no_error_allowed && atLeastOneError){
// do not incremented
} else{
numberGoodAnswer++
}
} else {
isCorrectReturnArray[key] = false;
atLeastOneError = true;
if(grainScheduled.grain_data.custom_data.no_error_allowed){
numberGoodAnswer = 0;
}
}
});
示例2: function
angular.forEach(scope.grainCopy.grain_copy_data.custom_copy_data.filled_answer_list, function(current_filled_answer){
if(current_filled_answer.text_right){
indexToRemove = null;
angular.forEach(scope.possible_answer_left_list, function(current_possible_left_answer, index){
if(current_filled_answer.text_right == current_possible_left_answer.text_right){
indexToRemove = index;
}
});
if(indexToRemove !== null){
scope.possible_answer_left_list.splice(indexToRemove, 1);
}
}
});
示例3: automaticCorrection
public automaticCorrection(grainScheduled:IGrainScheduled, grainCopy:IGrainCopy):{calculated_score:number, answers_result:{}} {
var numberGoodAnswer : number = 0,
atLeastOneError = false,
answerCorrect,
isCorrectReturnArray = {},
grainScheduled_correct_answer_list = angular.copy(grainScheduled.grain_data.custom_data.correct_answer_list);
angular.forEach(grainCopy.grain_copy_data.custom_copy_data.filled_answer_list, function(filled_answer, key){
answerCorrect = false;
angular.forEach(grainScheduled_correct_answer_list, function(correct_answer){
if(!correct_answer.alreadyMatch){
if(CompareStringHelper.compare
(
correct_answer.text,
filled_answer.text
) === true){
answerCorrect = true;
correct_answer.alreadyMatch = true;
}
}
});
if(answerCorrect){
isCorrectReturnArray[key] = true;
if(grainScheduled.grain_data.custom_data.no_error_allowed && atLeastOneError){
// do not incremented
} else{
numberGoodAnswer++
}
} else {
isCorrectReturnArray[key] = false;
atLeastOneError = true;
if(grainScheduled.grain_data.custom_data.no_error_allowed){
numberGoodAnswer = 0;
}
}
});
// computation score
var numberPossibleAnswer : number = grainScheduled.grain_data.custom_data.correct_answer_list.length;
var calculated_score = (numberGoodAnswer / numberPossibleAnswer) * grainScheduled.grain_data.max_score;
if(isNaN(calculated_score)){
throw "calculated score is not a number"
}
return {
calculated_score: calculated_score,
answers_result: isCorrectReturnArray
};
}
示例4: automaticCorrection
public automaticCorrection(grainScheduled:IGrainScheduled, grainCopy:IGrainCopy):{calculated_score:number, answers_result:{}} {
var numberGoodAnswer : number = 0,
numberRecognizedAnswer : number = 0,
atLeastOneError = false,
isCorrectReturnArray = {};
angular.forEach(grainCopy.grain_copy_data.custom_copy_data.filled_answer_list, function(filled_answer, key){
if(angular.isUndefined(filled_answer.isChecked)){
filled_answer.isChecked = false;
}
if(angular.isUndefined(grainScheduled.grain_data.custom_data.correct_answer_list[key].isChecked)){
grainScheduled.grain_data.custom_data.correct_answer_list[key].isChecked = false;
}
if(filled_answer.isChecked === grainScheduled.grain_data.custom_data.correct_answer_list[key].isChecked){
if(grainScheduled.grain_data.custom_data.correct_answer_list[key].isChecked){
// response is check and good
// in this case numberGoodAnswer++
numberRecognizedAnswer++;
isCorrectReturnArray[key] = true;
if(grainScheduled.grain_data.custom_data.no_error_allowed && atLeastOneError){
// do not incremented
} else{
numberGoodAnswer++
}
} else {
// response is not check and good
// in this case the answer is not good
isCorrectReturnArray[key] = undefined;
}
} else {
isCorrectReturnArray[key] = false;
atLeastOneError = true;
numberRecognizedAnswer++;
if(grainScheduled.grain_data.custom_data.no_error_allowed){
numberGoodAnswer = 0;
}
if(grainScheduled.grain_data.custom_data.correct_answer_list[key].isChecked){
// response is check and not good
isCorrectReturnArray[key] = true;
} else {
// response is not check and not good
isCorrectReturnArray[key] = false;
}
}
});
var calculated_score;
if(numberRecognizedAnswer == 0){
if(atLeastOneError){
calculated_score = 0
} else{
calculated_score = grainScheduled.grain_data.max_score;
}
} else {
// computation score
calculated_score = (numberGoodAnswer / numberRecognizedAnswer) * grainScheduled.grain_data.max_score;
}
if(isNaN(calculated_score)){
throw "calculated score is not a number"
}
return {
calculated_score: calculated_score,
answers_result: isCorrectReturnArray
};
}