當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。