Can your school’s GAA fixtures page show only the teams playing on your chosen date?
You’re checking your school’s GAA fixtures before making weekend plans. You pick Saturday, but the page still shows the whole month. How can you make that one choice bring back just the teams playing on Saturday?
Write down two requirements first: show only teams playing on the chosen date, and show a clear message if none are listed. Save this form as form dot HTML in your templates folder. It uses GET to send the labelled date field to slash fixtures when you press Show fixtures.
Pick the sixteenth of May and watch the date leave the browser in a GET request. The server reads it, asks SQLite for matching rows, then sends back a page. Your browser is the client. It displays the page the server returns.
You change the date and press Show fixtures again. The browser has your new choice, and the fixture records are in SQLite. Which part reads the submitted date and runs the query? Pick one.
Start your Flask app in app dot py. In the fixtures route, read the submitted date. Write a question mark where its value goes. Open the database and pass the date separately as the query’s one parameter. This is parameter binding. Fetch the rows, close the connection, and pass them to the template.
Run the first two SQL statements once in a new club dot DB file. Use an integer key and store dates and team names as text. Add Galway and Sligo on the sixteenth and Mayo on the seventeenth. Bind the sixteenth: rows one and two match. Sorting gives Galway, then Sligo.
Keep those same three records, but submit the seventeenth of May instead. The route runs the same SQL with a different bound value. Which team names should the query return this time? Pick one answer.
In the templates folder, save this as f dot HTML. Include the form first. Show results only after a date is submitted. If rows came back, make one list item per row using its first value, the team name. If no rows came back, show the message instead.
Run the finished app and open slash fixtures. Submit the sixteenth and check for Galway and Sligo only, in that order. Submit the eighteenth and check for the exact message. A blank results area could look like a fault. For both searches, record what you actually see and mark pass or fail.
If asked to describe how your artefact meets a user requirement, use your test for the sixteenth. Trace the date from the form into the GET request, then into the SQL parameter. Record which rows came back. Compare the page you actually saw with the pupil’s expected result.