For example, you want to set 40% alpha transparence to #000000
(black color), you need to add 66
like this #66000000
.
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
router.post('/complete-student-course', async (req, res) => { | |
let {studentId, courseId} = req.body; |
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
try { | |
let student = await Students.find({ 'studentId': studentId }).exec(); | |
/* | |
* After finding the student with the provided studentId, | |
* Use O(n) algorithm to find the course to complete for student | |
* It is unlikely for any student to have more than 5 courses in its course list at aytime | |
* Therefore, O(n) algorithm is ok | |
*/ |
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
// Update student data with new data without the deleted course | |
try { | |
let ccompleteRes = await Students.updateOne({ 'studentId': studentId }, student[0], { upsert: true }).exec(); | |
/* | |
* NOTICE THE CALL TO THIS FUNCTION | |
* I DID NOT USE AWAIT | |
*/ | |
updateCompletedStudents(courseId, student, res); |
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
async function updateCompletedStudents(courseId, student, res) { | |
/* | |
* Substract -1 from @continuingStudents on system | |
*/ | |
try { | |
//Get current system data | |
let system = await System.find({ 'systemId': SYSTEM_ID }).exec(); |
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
router.post('/complete-student-course', async (req, res) => { | |
let {studentId, courseId} = req.body; |
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
async function updateCompletedStudents(courseId, student, res) { | |
/* | |
* Substract -1 from @continuingStudents on system | |
*/ |
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
// Update student data with new data without the deleted course | |
try { | |
let ccompleteRes = await Students.updateOne({ 'studentId': studentId }, student[0], { upsert: true }).exec(); |
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
try { | |
//Update new system status | |
await System.updateOne({ 'systemId': SYSTEM_ID }, system[0], { upsert: true }).exec(); |
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
//Update new system status | |
let updateResult = await System.updateOne({ 'systemId': SYSTEM_ID }, system[0], { upsert: true }).exec(); | |
console.log('Update Result:', updateResult); |
OlderNewer