Skip to content

Instantly share code, notes, and snippets.

@wildan3105
Created June 23, 2018 06:28
Show Gist options
  • Save wildan3105/79a7bd61c6b323e64200a8493d62e0d5 to your computer and use it in GitHub Desktop.
Save wildan3105/79a7bd61c6b323e64200a8493d62e0d5 to your computer and use it in GitHub Desktop.
async.waterfall([
function(callback){
queries.getStudentByNIM(nim, function(err, std){
msg = 'You are choosing ' + lecturerChosen + ' STATUS : PENDING'
notifLength = std.notifs.length+1
callback(std[0])
})
},
function(callback){
queries.addNotif(nim, msg, notifLength, function(err){
callback(null)
})
},
function(callback){
queries.chooseLecturer(nim, lecturerChosen, function(err){
callback(null)
})
},
function(callback){
lect.getLecturerByUsername(username, function(err, lec){
nLength = lec.notifs.length
msgLec = 'You are chosen by '+ nim
callback(lec[0])
})
}], function(err, results){
if(!err) res.redirect(baseurl+'/lecturers')
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment