# Zápočtový test 22. 1. 2026 Bártík

Ještě před zápočtovým testem jsme měli udělat web, ve kterém se půjde zaregistrovat a přihlásit, vytvářet eventy s workshopy, registrovat se na ně, upravovat je a mazat je. S MySQL databází a nahráváním souborů. Viz [specifikace](/NSWI142/projekt-2025-26).

Celá akce nakonec trvala sedm hodin, hlavně kvůli čekání na review a iteraci oprav.

---

## Rules
- You have 3 hours.
- You can earn up to 15 points (zero points means it barely works).
    - A significant part of the evaluation is based on code quality.
    - Don't forget about security (validation, sanitization, etc.).
- You can use your own computer and access the internet as needed. However, AI is forbidden for complex tasks.
    - Any kind of communication with other people is strictly forbidden.
- Your points will be assigned in ReCodEx.
- If you are satisfied with the number of points in ReCodEx and you have completed everything, write to Petr Škoda to grade you in SIS.

## Favorite events
- An event can be marked as *favorite*. This feature is available only for logged-in users.
    - In the list of all events, each item contains a checkbox indicating whether the corresponding event is favorite.
    - In the event detail, there is the same checkbox.
- The information about which event is favorite is stored in the database. It's already present when the page is rendered on the server.
- Whenever the user checks/unchecks the checkbox, send a fetch request to the server to update the database.
    - Until the server responds, the checkbox should be disabled to prevent multiple requests.
    - If the server responds with an error, show an alert and revert the checkbox to the previous state.

### Filtering
- In the list of all events, there is a checkbox indicating whether to show only the favorite events.
- Pagination still works as expected.
    - I.e., when filtering, the first page contains the first 7 favorite events.
    - If a checkbox for an event is unchecked during filtering (so that the event is no longer favorite), it should disappear from the list (as soon as the server responds with success).

### Styles
- If you are bored, you can apply custom styles to highlight the favorite events (e.g., background color).

### Testing
- Make sure to create enough events (more than several pages) to test the pagination and filtering properly.