Deleting Exercises/Exercise Function Updated

 Written by: Quincy Williams

This week, I continued my focus on the exercise portion of the application as we come down to our final weeks of production of our app. There was a lot of focus on bug fixes as we are getting to the portion of development where the features are starting to be able to work together and in turn is introducing unexpected behaviors.

One of the main behaviors I was able to work out this week was how we allowed users to enter data. I needed to adjust some of the functions that we had in place that took care of formatting text from the json and also allow for the functions to think about user input as well. The function was adjusted so that if we did not need to properly format the text that was entered, that it should return that text. Initially, the logic was more strict to the json files that are locally loaded for our exercises as all of the information was essentially improperly formatted so there was very little variance needed in order to check if the text was already properly formatted. By default, it would return none, as usually there might have been missing data in the json, but now it is adjusted to make sure that it takes the entered value from the array list that the user entered data into and pass that into the exercise details.

Checking to make sure if formatted text is filled, to return that value



Once that was resolved, I was able to work on adding the functionality of allowing users to delete exercises. The team decided that we would keep this at the level of exercises that the user added and not allow for this to occur on the pre-loaded exercises. This was done by adding a new option to the FAB (Floating Action Button) that will allow for the user to delete the exercise. This was an issue at first as to how we would decide how the app would know what exercises were custom added by the user. I was able to find a way to make sure that the app checks for the id and that the IDs are unique from the locally loaded exercises that will ensure that the user can only delete the ones that they added. The values that is being read from the ID when the user selects the delete option will be from the secondary array where we load the custom exercises and once the exercise at that index that matches the ID of the exercise that is shown in exercise details, the user is updated, so the exercise is no longer in that array and no longer visible to the user.


Example of deleting a custom exercise


There was an issue that I will still need to resolve where the option is still available for the exercises that are locally loaded. Current, the resolution that is in place is that the delete button will be grayed out and inactive for the user, but the alternative that I will need to work for next week will be that the option is not visible to the user on locally added exercises.

Comments