Continued Progress…


With the midpoint update assignment out of the way, progress has resumed on the capstone project in a fairly big way. This week, I mostly focused on getting the Delete functionality implemented for each of the various question types. This involved creating a new Delete view for each question type, which when visited displays the question being considered for deletion, and has the user confirm his/her intent to delete. I also had to write the corresponding GET action for each question type’s controller to return this view when requested by a user clicking the appropriate “delete” link when viewing a test’s questions.

The deleting itself was accomplished by writing a POST action for each question type’s controller which finds the question with the given id in the questions table of the database, and deletes it, returning the user to the details of the test from which the question has been deleted. When viewing the Delete view for a given question, if the user confirms their desire to delete the question by clicking the Delete button, this action is executed and the question is deleted from the database.

Here is a demonstration of the delete question functionality I added:

Delete each question type demonstration

Additionally, while the delete test functionality has already been implemented previously, until now deleting a test would simply delete the test from the Tests table of the database, but leave all of the test’s questions in the Questions table of the database unchanged. I was able to address this by changing the delete POST action of the tests controller to first obtain a list of all the questions with a testId field matching the test id given as input to the function, by using the Where() and toList() functions, where the Where command was given an action which queried the Questions table for matches where question.TestId == id. I then created a simple ForEach function that iterated through this list of matching questions and deleted each from the database, before saving all the changes and returning.

A demonstration of deleting a test, including verification that these questions have been deleted from the Questions table of the database, is here:

Deleting a test deletes all questions in the test

While these are the changes I personally worked on this week, my team was also quite productive this week, implementing the test-taking functionality with a start test page, and saving a test-taker’s answers and score in the database upon submission. Pretty much all that remains to work on in the project is organizing the test-taker results for a given test-creator (i.e. creating a view which lists statistics on completion, scores, and users for each test a user has created), as well as minor functionality improvements and visual enhancements. The project is really coming together now! Until next time…

Print Friendly, PDF & Email

Leave a Reply

Your email address will not be published. Required fields are marked *