-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add courses students & final inscriptions qualify (#124)
- Add qualify all on courses students - Add qualify all final inscriptions
- Loading branch information
1 parent
ad79540
commit 9da368a
Showing
10 changed files
with
263 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 24 additions & 9 deletions
33
app/scripts/controllers/courses/CoursesFinalInscriptionShowCtrl.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,43 @@ | ||
'use strict'; | ||
|
||
define(['paw','services/Courses','services/Paths'], function(paw) { | ||
paw.controller('CoursesFinalInscriptionShowCtrl', ['$routeParams', 'Courses', '$log', 'Paths', function($routeParams, Courses, $log, Paths) { | ||
|
||
define(['paw','services/Courses','services/Paths', 'services/flashMessages'], function(paw) { | ||
paw.controller('CoursesFinalInscriptionShowCtrl', | ||
['$routeParams', 'Courses', '$log', 'Paths', 'flashMessages', '$route', | ||
function($routeParams, Courses, $log, Paths, flashMessages, $route) { | ||
var _this = this; | ||
var courseId = $routeParams.courseId; | ||
var inscriptionId = $routeParams.inscriptionId; | ||
|
||
this.qualifyAll = false; | ||
|
||
this.qualify = function() { | ||
var qualifiedStudents = _this.course.inscription.students.map(function(student) { | ||
if (student.grade) { | ||
return {docket: student.docket, grade: student.grade}; | ||
} | ||
}).filter(function(s) { | ||
return s !== undefined; | ||
}); | ||
Courses.qualifyFinalInscription(_this.course, inscriptionId, qualifiedStudents).then(function(response) { | ||
flashMessages.setSuccess('i18nQualifySuccessfully'); | ||
$route.reload(); | ||
}, function(response) { | ||
flashMessages.setError('i18nFormErrors'); | ||
$log.warn('[ERROR] - Response: ' + JSON.stringify(response)); | ||
$route.reload(); | ||
}); | ||
}; | ||
|
||
Courses.get(courseId).then(function(course) { | ||
_this.course = course; | ||
_this.course.all('finalInscriptions').get(inscriptionId).then(function(finalInscription) { | ||
_this.course.inscription = finalInscription; | ||
_this.course.inscription.students = finalInscription.history; | ||
}); | ||
}, function(response) { | ||
$log.info('Response status: ' + response.status); | ||
if (response.status === 404) { | ||
Paths.get().notFound().go(); | ||
} | ||
}); | ||
|
||
this.getStudentPath = function(docket) { | ||
return Paths.get().students({docket: docket}).path; | ||
}; | ||
|
||
}]); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.