本文整理汇总了TypeScript中entcore.ng.service方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ng.service方法的具体用法?TypeScript ng.service怎么用?TypeScript ng.service使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类entcore.ng
的用法示例。
在下文中一共展示了ng.service方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructor
import { IAutomaticCorrection } from '../../../../models/interfaces/IAutomaticCorrection';
import { IGrainCopy, IGrainScheduled } from '../../../../models/domain';
import { CompareStringHelper } from '../../../../models/helpers';
import { ng } from 'entcore';
export class SimpleAnswerService implements IAutomaticCorrection {
constructor() {}
public automaticCorrection(grainScheduled:IGrainScheduled, grainCopy:IGrainCopy):{calculated_score:number, answers_result:{}} {
var isCorrect = CompareStringHelper.compare
(
grainScheduled.grain_data.custom_data.correct_answer,
grainCopy.grain_copy_data.custom_copy_data.filled_answer
);
return {
calculated_score: isCorrect ? grainScheduled.grain_data.max_score : 0,
answers_result: {
filled_answer: isCorrect
}
};
}
}
export const simpleAnswerService = ng.service('SimpleAnswerService', SimpleAnswerService);
示例2:
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
};
}
}
export const multipleAnswerService = ng.service('MultipleAnswerService', MultipleAnswerService);
示例3: constructor
import { IAutomaticCorrection } from '../../../../models/interfaces/IAutomaticCorrection';
import { IGrainCopy, IGrainScheduled } from '../../../../models/domain';
import { ng } from 'entcore';
export class OpenAnswerService implements IAutomaticCorrection {
constructor() {}
public automaticCorrection(grainScheduled:IGrainScheduled, grainCopy:IGrainCopy):{calculated_score:number, answers_result:{}} {
return {
calculated_score: 0,
answers_result: {
filled_answer: null
}
};
}
}
export const openAnswerService = ng.service('OpenAnswerService', OpenAnswerService);
示例4:
}
});
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
};
}
}
export const qcmService = ng.service('QcmService', QcmService);
示例5:
// 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
};
}
}
export const associationService = ng.service('AssociationService', AssociationService);
示例6:
if(answerCorrect){
isCorrectReturnArray[filled_answer.order_by] = true;
if(grainScheduled.grain_data.custom_data.no_error_allowed && atLeastOneError){
// do not incremented
} else{
numberGoodAnswer++
}
} else {
isCorrectReturnArray[filled_answer.order_by] = 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
};
}
}
export const orderService = ng.service('OrderService', OrderService);
示例7:
import { ng } from 'entcore';
export interface IAccessService {
reader : boolean
}
export class AccessService implements IAccessService {
public reader : boolean;
}
export const accessService = ng.service('AccessService', AccessService);