Foundations of Software Engineering

Homework 6: MVC Controller

For this homework, you will build upon the models from the previous homework to create an actual working web app—mainly by adding controllers and views. Moreover, you will continue to practice with the version-control system, Git.

You will do this homework as a team; however, each member of your team will be responsible for the completion of a particular task.

Each team member will choose one task from the list below to complete. All team members must do a different task. If your team has only three members, then ignore Task 4.

Once everyone has selected their tasks, you must follow the workflow in this instructional video. Follow all the steps carefully, including submitting your team’s work as a GitHub release.

The Tasks

For this homework, there will be four tasks (Tasks 1 through 4), each of which will build upon the corresponding task from Homework 5. Recall the model classes from the previous homework:

Task 1:

alt text

Task 2:

alt text

Task 3:

alt text

Task 4:

alt text

In particular, each task for this homework must build upon these model classes by completing each of the following parts.

Part 1: Add More Model Validations and Unit Tests

In the previous homework task, you added validations to only one of the model classes. For this homework, you must add validations to the other model class. In particular, you must add at least one validation per attribute of the class, and each validation must be of a different type. For example, the first attribute might have a length validation, the second might have a format validation, the third might have an inclusion validation, and the fourth might have a numericality validation.

Additionally, you must also create unit tests for these new validations. In particular, you will treat these validations the same as you did for the last homework—that is, for each validation, you must write one test that violates the validation rule.

Part 2: Add Bootstrap to Your Pages

Your team must add Bootstrap styling to your pages (as discussed in this demo). There are a number of centralized changes that must be made to your project code, so you will need to coordinate closely with your teammates. You need not fix bugs in your view pages from the previous homework (although you can if you like). Mainly, you should use the Bootstrap styles moving forward. Also, your team must centrally add alert/notify messages so that they are capable of appearing on any page between the menu bar and the page body content (as demonstrated).

Part 3: Create a Specialized Form

All of these tasks should involve adding a form page/action, an action for processing form submissions, and adding to the a hyperlink to your project’s home page that links to the form. Also, once the form submission is processed, it should redirect to the home page and display an appropriate flash message.

Task 1: Using the School model class, create a form that shows the user a random school from the database. It should show the user only the name, url, and category. It should ask the user to guess the year the school was founded from a list of three years. One should be the correct year, and the other two should be randomly chosen from the years 10 years before to 10 years after the correct year. These options should be presented as a radio button (as demonstrated in this video). The distractors should be chosen randomly each time the form loads, and the order of the answers should also be randomized. The form should report whether or not the user guessed correctly.

Task 2: Using the TeachingEvaluation model class, create a form that shows the user a random teaching evaluation from the database. It should show the user only the metareviewer, the number of respondents, and the comment. It should ask the user to guess the median rating from a list of four options. One should be the correct median rating, and the other three should be the other possible values for the median rating (as defined in Homework 5). These options should be presented as a radio button (as demonstrated in this video). The order of the answers should also be randomized. The form should report whether or not the user guessed correctly.

Task 3: Using the Student model class, create a form that shows the user a random student from the database. It should show the user only the honorific, the last name, and the dob. It should ask the user to guess the IQ from a list of four options. One should be the correct IQ, and the other three should be different integer values randomly chosen from the range 0 to 300. These options should be presented as a radio button (as demonstrated in this video). The distractors should be chosen randomly each time the form loads, and the order of the answers should also be randomized. The form should report whether or not the user guessed correctly.

Task 4: Using the HomeworkGradeSheet model class, create a form that shows the user a random homework grade sheet from the database. It should show the user only the score and feedback. It should ask the user to guess the grade from a list of five grades. One should be the correct grade, and the other four should be different grades randomly chosen from the possible grade values (as defined in Homework 5). These options should be presented as a radio button (as demonstrated in this video). The order of the answers should be randomly sorted each time the page loads. The form should report whether or not the user guessed correctly.

Part 4: Create Seed Data

Create 5 different seed-data objects for each model class (i.e., in db/seeds.rb) for a total of 10. Be sure to use the create! method (with a !) to create them, so you will get error messages if a validation error occurs.

Part 5: Create Standard Controller Actions/Pages

Create two controllers, each corresponding to a model class. (You probably already created one in performing the above tasks.) Each controller must have the standard controller actions/pages detailed in this demo video:

The pages must have the features demonstrated in the demo, including inter-page links and notice/alert/error message handling. Be careful to follow the standard Ruby/Rails naming conventions.

As additional constraints, you must:

Part 6: Create “Lucky” Actions

In addition to the standard actions/pages, you must do the following for each of your controller classes:

You must add hyperlinks to your controllers’ index pages on the project home page. This will enable visitors (and graders) to conveniently navigate to each team member’s pages.

Rubric

Total points: 100

Below, the top-level number is the items total point value. If an item is not submitted at all or it is irredeemably broken, 0 points will be awarded for that item. The sub-bullets indicate standard deductions for errors in a submitted item. The deduction list below may not be complete because there may be mistakes that we did not expect. The deduction for an unexpected mistake will be assessed at the time it’s discovered and will reflect how severe the instructor thinks the mistake is.

Other deductions:

© Scott D. Fleming 2019 • Made with GitHub Pages and Markdown