UNPKG

unserver-unify

Version:

31 lines (28 loc) 842 B
angular.module('bamboo.course').controller('TestChapterCtrl', function($scope, $stateParams, CourseApi, CommonService, ExamService) { var self = this; this.cid = $stateParams.cid; this.id = $stateParams.rid; function getInfo() { var info = { action: 'getresource', id: self.id, }; CourseApi.mvApi(info, function(result) { console.log(result); if(result.success){ self.chapter = result.data; convertQuestions(); } }); } getInfo(); function convertQuestions() { angular.forEach(self.chapter.questions, function(q, index) { console.log('q to convert', index); ExamService.convertV1Question(q); if (q.type == 'single' || q.type == 'multiple') { q._options = _.shuffle(q._options); } }) } });