当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript ng.service方法代码示例

本文整理汇总了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);
开发者ID:OPEN-ENT-NG,项目名称:exercizer,代码行数:28,代码来源:SimpleAnswerService.ts

示例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);
开发者ID:OPEN-ENT-NG,项目名称:exercizer,代码行数:30,代码来源:MultipleAnswerService.ts

示例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);
开发者ID:OPEN-ENT-NG,项目名称:exercizer,代码行数:19,代码来源:OpenAnswerService.ts

示例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);
开发者ID:OPEN-ENT-NG,项目名称:exercizer,代码行数:30,代码来源:QcmService.ts

示例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);
开发者ID:OPEN-ENT-NG,项目名称:exercizer,代码行数:30,代码来源:AssociationService.ts

示例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);
开发者ID:OPEN-ENT-NG,项目名称:exercizer,代码行数:30,代码来源:OrderService.ts

示例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);
开发者ID:OPEN-ENT-NG,项目名称:exercizer,代码行数:12,代码来源:AccessService.ts


注:本文中的entcore.ng.service方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。