Batch Code Generation

I didn’t understand the part that how the batch code in generated. Sir is calling batchcode+=req.body.course so the value of course is Android not AD and sir also not taking the substring like he did in the case of year then how is this creating a batch code…
And where is the source code of these files are uploaded as i checked in the coding blocks archives it is not present there.

Hi @amanmahajan987,
The batchcode is generated by simply concatenating value to an empty string i.e Suppose we want WDPP18S1 as batchcode then

  • WD is course taken : here we access it by req.body.course and we are not using substr function because the course name coming in the req.body.course is coming of the form AD/WD (short form because in html file we have mapped the courses with the id’s if you, see by giving them value={{co.id}} whereas displaying full name of course on frontend of the form)

  • Then centre, year , season, batch-no is concatenated respectively to the batchcode string .

Please refer to line 32 of the batchcode.hbs file where its written :
<option value = "{{co.id}}">{{co.name}}</option>
here the names are shown on front end and the value passes is the course id of the form WD,AD etc is given therefore the substr method is not used.

Course resources can be found at : Link

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

Thank you for helping me out in the code
But the link you provided for the code does not contain these codes.
This video is recorded video of 2018
So they are not present inside the 2020 nodejs repositary