CiTi · Computer Coding · Year Two · Unit 1
A project within “Building Data-Driven Applications”
How do I map out my data design?
Before students can build an admin page, they have to map every field in a table to the right form control, and every stored code (6) to the word a person reads (Oswego). The roster table is one they already live in: it is the record behind their own login. That makes the data design concrete before they map their own Unit 1 project.
Demonstrate proficiency with:
Database Fundamentals Managing Data-Driven Application Abilities Backend Administration Design & DevelopmentHands-On:
#1 Write valid, semantic HTML5
#5 Write and execute database queries
#7 Validate and debug my own work
#8 Write JavaScript that responds to a user
Professional:
#5 Work through ambiguity
#7 Treat a mistake as data, not failure
#9 Document as you go
Data as codes: a stored number stands for a meaning (1 = AM, 6 = Oswego), and a page translates both ways. Unique identifiers: a record number finds exactly one row, and a username must be unique across the table. Ordering: text order puts 10 before 2, number order does not.
Building a back-end tool for a non-technical user: clear labels, safe defaults, a confirm before anything destructive. Handling live data with care (test on your own records only). Writing and running a test plan and recording the results, the way a QA step works on a real team.
HTML: one form per record, open-and-close rows with the details/summary pair, grouped fields with fieldset and legend, the right input types, submit buttons that carry their own value. WebDNA: search with view and sort options (numeric sort), found-items loops, a related table (district.db) through a foreign key: a lookup for the summary and a nested search for the dropdown, pre-selecting dropdowns, append with an auto-numbered record, replace and delete by record number, URL-encoding every saved value, a duplicate check, post-then-redirect, code-word messages, blanking fields that were never sent, closing the database. JavaScript: events, a confirm box, data attributes, class toggling, the leave-page warning.
Students will understand how one page can be a complete, safe interface to an existing database: and will build an inline admin form for the program roster that lists, adds, edits, and deletes records, then prove it works with a written test plan.
r_district) to show and choose a value from a related table (district.db).Students build a back-end admin page against the real structure of the program’s own roster table: the same “admin CRUD page for an existing database” job a junior developer gets. Push further: build the same admin page for the student’s own Unit 1 project table (Online Journal, Student Project, Material Inventory, or Tournament Laddering), with the instructor or a staff member acting as the client who will use it.
roster.db with 12 made-up students (10 active, 2 inactive, mixed sessions, levels, and districts; computer numbers 2, 10, and 19 for the numeric-sort test), with fake passwords and example.org emails, and district.db (sku, district) with the 9 districts. roster.db’s r_district holds a district sku. Students put both in lessons/assignments/databases/ and build lessons/assignments/week2.html. Never hand out the live roster: it holds real logins./citi/coding/ajm/multform/index.html, the finished page, which is also the answer key. It writes to its own copy of roster.db, so demo Add, Save, and Delete only on a test record, and don’t share the URL with students: anyone with the link can change the data. Last year’s student version is next to it as indexex.html (useful as a “find the bugs” warm-up).A finished-looking static page with hand-typed sample students. Each student is a closed summary row that opens to a labeled, grouped edit form with Save, Delete, and Undo. Plus an Add form, a Show/Sort toolbar, an inactive style, and phone width. No database.
Replace the samples with a search of roster.db. Show and Sort, count, numbers translated to words, pre-selected dropdowns. Add, Save, Delete with encoded values, duplicate-username check, redirect after every change, code-word messages, blanked never-sent fields. Must work with JavaScript off.
Delete confirm (name from a data attribute), Expand/Collapse all, “unsaved” row marker, leave-page warning. No data is ever saved by JavaScript.
12 written tests run on the live page, results recorded. Covers special characters, duplicates, school year, inactive, refresh, numeric sort, unsaved, delete cancel, View Source, phone width.
Students show the teacher at the end of each part before moving on. Each part is a checkpoint grade.
| What students see | Usual cause |
|---|---|
| Saving a student changes their school year | The year dropdown pre-selects this year instead of the record’s year (last year’s student version had this bug) |
| “O’Brien & Sons” saves as “O’Brien ”; a password is cut off at = | Values in append/replace are not URL-encoded |
| A box or message shows its own name in brackets, like [fname] | Field was never sent on this request; it must be blanked at the top of the page |
| Refresh adds the same student again | No redirect after the append |
| Save does nothing, or only Enter saves | Submit button missing or hidden; or the form wraps table cells (one form per record must wrap the whole record) |
| Every record changes at once, or none do | The hidden record number is missing, or misnamed (never call the field sku) |
| District shows blank or “Unknown” for everyone | Lookup written with the wrong setting name (it takes value=), or a path or field name typo (r_district, district) |
| Every student’s district dropdown opens on the same district, or no district is selected | Inside the district search, sku is the district’s sku. The student’s r_district must be saved in a text variable before the inner search, and compared to that |
| Saving a student blanks their district | The dropdown is still named district; it must be r_district to match the field |
| Computer # sort puts 10 before 2 | Numeric sort missing its “type = number” setting |
| Changes don’t show up, or the db file looks stale over SFTP | No close-database at the end of the page |
| Whole list disappears after a student edits roster.db | The file was resaved in an editor: line endings or tabs changed. Download roster.zip again for a fresh copy |
| JavaScript breaks or prints oddly | Square brackets in the script were read as WebDNA (for example an attribute selector or array index) |
| Delete confirm breaks on some names | Name pasted into the script; an apostrophe ends the string. Use a data attribute |
| Day | Phase | What happens |
|---|---|---|
| Day 1 | Hook + Data Map + Part 1 | Show last year’s student version: pairs list everything an admin would trip over (hidden Save, wrong year, no confirm). Walk the Know Your Data table: codes vs. words, the record number, why usernames must be unique, and the district.db link (primary key sku, foreign key r_district). Students sketch the page on paper, then start the shell and one open-and-close row. |
| Day 2 | Part 1 build | Full edit form, grouping, buttons, Add form, toolbar, inactive style, phone width. Checkpoint: Part 1 shown to teacher by end of day. |
| Day 3 | Part 2: Read | Mini-lesson: the page layout (settings, action section, HTML, close). Students replace samples with the search, translate codes, look up district names and build the district dropdown from district.db, pre-select dropdowns, add the count, Show and Sort. |
| Day 4 | Part 2: Write | Mini-lesson: forms that post to themselves, buttons that carry an action, encoding. Students build Add, Save, Delete on test records, then run the O’Brien & Sons test. |
| Day 5 | Part 2: Make it safe | Mini-lesson: what Refresh does after a post; why a message from the address bar is dangerous. Students add the duplicate check, redirect, code-word messages, and blank never-sent fields. Test with JavaScript off. Checkpoint: Part 2 shown to teacher. |
| Day 6 | Part 3 + Test Plan | Short demo: events and a confirm box. Students add the four helpers, then pairs run each other’s 12-test plan on the live page and record results. Students delete their test records. Checkpoint: Part 3 + test plan. |
Formative: the three checkpoints. Each part’s “Done when” list on the assignment page is the checklist.
Summative (100 pts): UI 30, DNA / Data 50, JavaScript 15, Test Plan 5. Grade the live page, not the source alone: run the 12 tests yourself, then View Source.
Exit question (after Part 2): “Why does the page redirect after every save? What would happen without it?”
Extension: (1) Add a simple admin login check so only admins reach the page. (2) Add a quick filter box that hides rows as you type. (3) Build the same admin page for the student’s own Unit 1 project table.