{"id":25,"date":"2022-04-29T01:51:41","date_gmt":"2022-04-29T01:51:41","guid":{"rendered":"https:\/\/blogs.oregonstate.edu\/clearhorizons\/?p=25"},"modified":"2022-04-29T01:54:10","modified_gmt":"2022-04-29T01:54:10","slug":"accomplishments","status":"publish","type":"post","link":"https:\/\/blogs.oregonstate.edu\/clearhorizons\/2022\/04\/29\/accomplishments\/","title":{"rendered":"Accomplishments&#8230;"},"content":{"rendered":"\n<p>I&#8217;m excited to report that a lot of progress was made this week on the project.  I spent most of the week working on the EDIT functionality of each of the question types, which involved both backend and frontend development work.  Following last week&#8217;s work getting the Edit view implemented for True\/False questions (but not actually updating anything), I began this week by learning how to implement a POST action of the True \/ False question controller to handle the updating of the question being updated in the database itself.  I then edited the edit view for true \/ false questions to submit the updated data to the controller action, and was pleased to see everything working!  Here is an example of editing a True\/False question:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1043\" height=\"638\" src=\"https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/5531\/files\/2022\/04\/edit_demo-1-1.gif\" alt=\"\" class=\"wp-image-27\" \/><\/figure>\n\n\n\n<p>With this accomplishment, I was then able to apply the things I learned to the other question types.  I next implemented editing of free-response questions, which ended up being very similar to the True \/ False questions.  Here is an example:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1043\" height=\"638\" src=\"https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/5531\/files\/2022\/04\/edit_demo-2.gif\" alt=\"\" class=\"wp-image-28\" \/><\/figure>\n\n\n\n<p>Multiple choice was next, which presented a bit more of a challenge, as I needed to write JS code to execute on load that used the input question data to populate the text fields accompanying each possible answer&#8217;s radio button, as well as selecting the previously-chosen answer in the form.  This was actually considerably difficult because of differences in how C# and JavaScript work with Model data being used by the view.  To obtain a usable JavaScript list of possibleAnswers from the input model required using JavaScript&#8217;s JSON.parse() in combination with C#&#8217;s Html.Raw() and Json.Serialize() functions to successfully work with the data.  Here is an example of editing a multiple choice question:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1043\" height=\"638\" src=\"https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/5531\/files\/2022\/04\/edit_demo-3.gif\" alt=\"\" class=\"wp-image-29\" \/><\/figure>\n\n\n\n<p>Finally, the most challenging portion of this week&#8217;s work involved implementing the Edit functionality of the Check-All-That-Apply question type, as this question type involves an unbounded number of possible answers that the user can add during question creation.  I decided that I needed to implement a &#8220;delete possible answer&#8221; function, which was not included in the original create question view.  This involved writing a considerable amount of JavaScript code to allow for the dynamic addition and deletion of an arbitrary number of possible answers to a particular question, as well as a solution to ensure that the final resulting form, when submitted, has proper incrementing field ids and names so that the controller is able to save the updated question properly.  I was able to solve this problem by implementing a function that executes whenever the &#8220;Save&#8221; button is clicked, that iterates through the table elements, properly setting the field ids and names, before ultimately submitting the data to the controller.  Here is an example of editing a Check All That Apply Question:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1043\" height=\"638\" src=\"https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/5531\/files\/2022\/04\/edit_demo-4.gif\" alt=\"\" class=\"wp-image-30\" \/><\/figure>\n\n\n\n<p>Anyway, it&#8217;s been a lot of work, but I&#8217;m proud of the accomplishments I&#8217;ve achieved on the project this week.  Over the next week, I&#8217;ll focus on implementing the DELETE functionality for each question type, as well as tests overall.  The midpoint of the project is next week, and I&#8217;m feeling confident in our ability to complete the project to specification and on time.  I&#8217;m also happy to report that our project is now hosted and accessible, and can be checked out <a href=\"https:\/\/cairnsicapstoneproject.azurewebsites.net\/\">here<\/a>.  Until next time&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m excited to report that a lot of progress was made this week on the project. I spent most of the week working on the EDIT functionality of each of the question types, which involved both backend and frontend development work. Following last week&#8217;s work getting the Edit view implemented for True\/False questions (but not [&hellip;]<\/p>\n","protected":false},"author":12368,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-25","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.oregonstate.edu\/clearhorizons\/wp-json\/wp\/v2\/posts\/25","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.oregonstate.edu\/clearhorizons\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.oregonstate.edu\/clearhorizons\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/clearhorizons\/wp-json\/wp\/v2\/users\/12368"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/clearhorizons\/wp-json\/wp\/v2\/comments?post=25"}],"version-history":[{"count":3,"href":"https:\/\/blogs.oregonstate.edu\/clearhorizons\/wp-json\/wp\/v2\/posts\/25\/revisions"}],"predecessor-version":[{"id":33,"href":"https:\/\/blogs.oregonstate.edu\/clearhorizons\/wp-json\/wp\/v2\/posts\/25\/revisions\/33"}],"wp:attachment":[{"href":"https:\/\/blogs.oregonstate.edu\/clearhorizons\/wp-json\/wp\/v2\/media?parent=25"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/clearhorizons\/wp-json\/wp\/v2\/categories?post=25"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/clearhorizons\/wp-json\/wp\/v2\/tags?post=25"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}