I can enter a list of schools, and guidance for entering terms
So that user input will be properly validated
This is an Epic, not a single issue
This is an Epic, meaning that this issue is intended to be the "master issue" that is broken into multiple individual issues.
Copy the user stories/acceptance criteria into a separate issue before starting to work on it, and make PRs for each part separately. Benefits to this staged approach:
You'll earn more points that way
You'll earn them more quickly
PRs are easier to code review and merge
If you don't finish, you get partial credit for what you did complete, and students in a future class can finish off your work.
Discussion
Currently, when entering a course, the school field is free form.
We'd like that, instead, to be a dropdown with a list of schools so that the data will be more uniform.
To this end, we want admins (only admins) to be able to do CRUD operations on a table that with four fields:
abbrev (String; suggest that schools use their lowercase, .edu domain name, e.g. ucsb for UCSB, oregonstate for Oregon State University, wsu for Washington State University, hilo.hawaii for U. Hawaii-Hilo, etc. (required, use as primary key)
name (e.g. "UC Santa Barbara", "Oregon State University", "Washington State University") (required)
termRegex (e.g. [WSMF]\d\d) optional string
termDescription (e.g. Enter quarter, e.g. F23, W24, S24, M24), optional string.
termError (e.g. 'Quarter must be entered in the correct format`)
Once this table exists, the free form entry in the CourseForm for term can be replaced with a drop down from the entries in this table. The courseForm can do a useBackend call to get the list of schools and populate a downdown. It can also put the text for term description next to the term box. (In the first version, we can ignore the termRegex and termError messages; those are for a later issue below.
Note that this will mean that at least one school must be in the table before any courses can be created. To make things easier, it may be helpful (in a separate issue) to add code that, on startup, checks to see if the Schools table is empty, and if so, has code that inserts this entry into the Schools table during application startup:
abbrev: "other"
name (e.g. "school not listed above")
termRegex (empty/null)
termDescription ("Enter abbreviation for quarter or semester in which course takes place")
termError (empty/null)
That way courses can be entered immediately.
Once that's done, we can work on an issue that, in the Course form, will also use the regex and error message to validate the term entries based on the school that is selected. Note that this requires those to be changed dynamically based on the value selected in a dropdown on another part of the form, so this may or may not be straightforward; it will require react knowledge that is beyond the examples already in the code base. So that may be a particular challenging issue.
Acceptance Criteria
This list is for the entire epic; you'll need to break these down into the specific issues; each of these roughly corresponds to one issue.
[ ] Admin can do CRUD operations on Schools table as described above
[ ] When creating or updating courses, the user can no longer enter free form text on the new course form; instead school will be selected from a dropdown.
[ ] When creating or updating courses, the user is shown an explanation beside the term field that changes depending on the school chosen from a drop down.
[ ] When entering or updating courses, and when entering a value for term, the term is verified against a regular expression that changes depending on the school chosen from a drop down.
[ ] When entering or updating courses, and when entering a value for term, if/when the term doesn't match the regular expression for the chosen school, a school specific error message is shown.
Implementation Todos
B1: Backend Issue: entity/repository for schools
[ ] entity and repository class for schools table
B2: Backend Issue: schools controller: GET all, GET by id, POST
[ ] POST /api/schools school (does backend validation of fields at least in terms of required/optional)
[ ] GET /api/schools/all
[ ] GET /api/schools?id=ucsb
B3: Backend Issue: PUT, DELETE
[ ] PUT /api/schools?id=123
[ ] DELETE /api/schools?id=123
F1: Frontend: Form / Table for schools
[ ] Form for create / update, with storybook entries and tests
[ ] Table for index page (with links to edit/delete) with storybook entries and tests
F2: Frontend Create and Index Pages
[ ] Index Page that uses table with link to delete and edit pages (edit page can be real or a placeholder for this issue)
[ ] Create Page that uses form
[ ] If edit page is a placeholder, add issue F2a to replace placeholder with real edit page.
F3: Frontend CourseForm uses schools dropdown
[ ] Add separate component SchoolsDropdown that takes a list of schools as a prop (in the format returned by the backend GET /api/courses/all endpoint and provides a dropdown containing the abbrev values)
[ ] Add storybook and tests for SchoolsDropdown
[ ] Replace free form text for entering school with SchoolsDropdown
[ ] The default value of the SchoolsDropdown should be that no school is chosen, which should be a validation error for creating or updating a school (since school is required)
[ ] Make sure that all tests for create page and edit page still work.
F4: Frontend Course Form shows school specific term description
[ ] After selecting a school on the course form, the text for the termDescription for that school will be displayed near the place where the user is supposed to enter the term
[ ] Any time the school is changed before the school is created or saved, the termDescription text should change
[ ] That's all for this issue. Get this working first before tackling the regex thing
F5: Frontend Course Form uses school specific regex.
[ ] After selecting a school on the course form, the regex for that school is loaded and applied to the value in the term field
[ ] If the term field does not match the regex for that school, the school specific error message is displayed
[ ] Any time the school is changed before the school is created or saved, the regex is reloaded and applied to the current value of term. If there is an error with the new regex, the new message is displayed.
[ ] Any time the term field changes. the regex for the current school is applied to the new contents, and the error message updates if needed.
[ ] When the school is entered, a term is entered, and the matching regex is satisfied, no error message displays and the user is permitted to save the new or updated school.
User Story for Epic
This is an Epic, not a single issue
This is an Epic, meaning that this issue is intended to be the "master issue" that is broken into multiple individual issues.
Copy the user stories/acceptance criteria into a separate issue before starting to work on it, and make PRs for each part separately. Benefits to this staged approach:
Discussion
Currently, when entering a course, the school field is free form.
We'd like that, instead, to be a dropdown with a list of schools so that the data will be more uniform.
To this end, we want admins (only admins) to be able to do CRUD operations on a table that with four fields:
.edu
domain name, e.g.ucsb
for UCSB,oregonstate
for Oregon State University,wsu
for Washington State University,hilo.hawaii
for U. Hawaii-Hilo, etc. (required, use as primary key)[WSMF]\d\d
) optional stringEnter quarter, e.g. F23, W24, S24, M24
), optional string.Once this table exists, the free form entry in the CourseForm for term can be replaced with a drop down from the entries in this table. The courseForm can do a useBackend call to get the list of schools and populate a downdown. It can also put the text for term description next to the term box. (In the first version, we can ignore the termRegex and termError messages; those are for a later issue below.
Note that this will mean that at least one school must be in the table before any courses can be created. To make things easier, it may be helpful (in a separate issue) to add code that, on startup, checks to see if the Schools table is empty, and if so, has code that inserts this entry into the Schools table during application startup:
That way courses can be entered immediately.
Once that's done, we can work on an issue that, in the Course form, will also use the regex and error message to validate the term entries based on the school that is selected. Note that this requires those to be changed dynamically based on the value selected in a dropdown on another part of the form, so this may or may not be straightforward; it will require react knowledge that is beyond the examples already in the code base. So that may be a particular challenging issue.
Acceptance Criteria
This list is for the entire epic; you'll need to break these down into the specific issues; each of these roughly corresponds to one issue.
Implementation Todos
B1: Backend Issue: entity/repository for schools
B2: Backend Issue: schools controller: GET all, GET by id, POST
B3: Backend Issue: PUT, DELETE
F1: Frontend: Form / Table for schools
F2: Frontend Create and Index Pages
F3: Frontend CourseForm uses schools dropdown
GET /api/courses/all
endpoint and provides a dropdown containing the abbrev values)F4: Frontend Course Form shows school specific term description
F5: Frontend Course Form uses school specific regex.