This week I will be talking about our last sprint. This sprint may not even be done yet since even now, some of us are still trying to work on the issues on git hub. This sprint is unlike the others, I think we actually accomplished more during this sprint. As I have said before, most of our past sprint consists of waiting for the customer to respond or try to plan something for the intake form but then have to change it because the customer does not need it.
During this sprint, I worked on fixing the student ID of the intake form. The student ID field was getting the input as a number but there is a problem with a number as an input. The first problem is that a number can not start with a 0, it will only start at 1 or any number that is not 0. Our actual student ID starts with a 0 so that would not work. The other problem is that we want to capture the student ID after a student swipes their card. After turning the student ID input field into text, I had to then remove all the unnecessary characters that are inputted by swiping their OneCard. This can be done by using the slice method that is from javascript but you can use it in typescript, I think most javascript functions can be used in typescript. The student ID that we get from the card reader is in the format of “;0000111111100?”. The only characters we want is from 5 to 12, which is the actual student ID that you will get from OneCard. Then, I tried using the function slice to get only those characters.
After turning the field into text and slicing the character, I was able to make it work by adding the following code into the onSubmit function since I only want it to happen after they submit the form so that it would look clean on the database.
Code inside onSubmit: this.model.studentId = this.model.studentId.slice(4, –3);
The next thing that I did was to create a way for the food pantry to be able to enter the student ID on their own. Sometimes students might not have their OneCard with them. So, I created an if statement in the onSubmit field, I did not want to do it on the actual form with the ngIf because it gets messy with the ng-template stuff.
Code:
if (this.model.studentId.charAt(0) === ‘;‘) {
this.model.studentId = this.model.studentId.slice(4, –3);
}
This was the final code that I pushed into master. I was actually working on other things, like checking if they entered a letter, if they did, create an alert.
This sprint was very interesting to me. I learned a lot of things. The thing that stuck with me the most is making sure that the field would only take what it is supposed to. After working on it, I would like to add more stuff to check the ID field, like if the length is greater than or less than 8 then it is invalid if it contains other symbols that is not
“; or ?”. There is still a lot of work to do for the intake form but I enjoyed it.
From the blog CS@Worcester – Computer Science by csrenz and used with permission of the author. All other rights reserved by the author.