File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,8 +30,7 @@ module.exports = function() {
3030
3131 return co ( function * ( ) {
3232 var group = yield CourseGroup
33- . findOne ( { slug : args . group } )
34- . exec ( ) ;
33+ . findOne ( { slug : args . group } ) ;
3534
3635 if ( ! group ) {
3736 throw new Error ( "No group:" + args . group ) ;
@@ -40,13 +39,14 @@ module.exports = function() {
4039 var participants = yield CourseParticipant . find ( {
4140 isActive : true ,
4241 group : group . _id
43- } ) . populate ( 'user' ) . exec ( ) ;
42+ } ) . populate ( 'user' ) ;
4443
4544 var recipients = participants
4645 . map ( function ( participant ) {
4746 return { email : participant . user . email , name : participant . fullName } ;
4847 } ) ;
4948
49+ log . debug ( recipients ) ;
5050
5151 var teacher = yield User . findById ( group . teacher ) ;
5252 recipients . push ( {
@@ -57,7 +57,9 @@ module.exports = function() {
5757 // filter out already received
5858 var recipientsByEmail = _ . indexBy ( recipients , 'email' ) ;
5959
60- var label = path . basename ( args . templatePath ) ;
60+ var label = group . slug + '/' + path . basename ( args . templatePath ) ;
61+
62+ log . debug ( "Filter by label" , label ) ;
6163
6264 let letters = yield mailer . Letter . find ( { label : label } ) . exec ( ) ;
6365 for ( let i = 0 ; i < letters . length ; i ++ ) {
You can’t perform that action at this time.
0 commit comments