···88- [com.atproto.repo.applyWrites](https://docs.bsky.app/docs/api/com-atproto-repo-apply-writes) Batch endpoint for writes
99 that allows you to create, update, or delete multiple records.
10101111-Great job beating Part 1! Now onto Part 2.
1111+Like the previous record you found at `{{at_uri}}`, you will write your own `codes.advent.challenge.day` record in your
1212+own repository at the record key `2` and set the property `partTwo` to `{{code}}`.
12131313-Keeping it simple proof of concept, blah, blah will have a real one here another time. Add a new field `partTwo` to the
1414-record with the value `{{code}}`
1414+The contents of the record would look about like this:
1515+1616+```json
1717+{
1818+ "$type": "codes.advent.challenge.day",
1919+ "partTwo": "<your code>"
2020+}
2121+```
15222323+Once you have written the record to your own repository, please click "Check answer" below to see if you got it right.
16241717-[//]: # (<input type="file" id="part_one_input" placeholder="Enter your code here" />)
···11+// @generated - This file is generated by esquema-codegen (forked from atrium-codegen). DO NOT EDIT.
22+pub mod record;
33+pub mod codes;
+48-1
web/src/main.rs
···294294 Ok(())
295295}
296296297297-/// Landing page showing currently unlocked days and a login button
297297+/// The default handler that will be used during the advent month, but not during amtosphere conf
298298async fn home_handler(State(pool): State<PgPool>, session: AxumSessionStore) -> impl IntoResponse {
299299 //TODO make a helper function for this since it is similar to the middleware
300300 let now = chrono::Utc::now();
···337337 is_logged_in,
338338 })
339339}
340340+341341+/// The default handler that will be used during the advent month, but not during amtosphere conf
342342+async fn dec_home_handler(
343343+ State(pool): State<PgPool>,
344344+ session: AxumSessionStore,
345345+) -> impl IntoResponse {
346346+ //TODO make a helper function for this since it is similar to the middleware
347347+ let now = chrono::Utc::now();
348348+ let mut unlocked: Vec<u8> = Vec::new();
349349+350350+ //HACK Yeah I don't like it either - bt
351351+ let prod: bool = env::var("PROD")
352352+ .map(|val| val == "true")
353353+ .unwrap_or_else(|_| true);
354354+ if prod {
355355+ if now.month() == 12 {
356356+ let today = now.day().min(25);
357357+ for d in 1..=today {
358358+ unlocked.push(d as u8);
359359+ }
360360+ }
361361+ } else {
362362+ for d in 1..=25 {
363363+ unlocked.push(d as u8);
364364+ }
365365+ }
366366+367367+ // Get completion status for all days at once
368368+ let did = session.get_did();
369369+ let is_logged_in = session.logged_in();
370370+ let all_statuses = get_all_days_completion_status(&pool, did.as_ref())
371371+ .await
372372+ .unwrap_or_else(|_| (1..=25).map(|day| (day, CompletionStatus::None)).collect());
373373+374374+ // Filter to only include unlocked days
375375+ let unlocked_with_status: Vec<DayStatus> = all_statuses
376376+ .into_iter()
377377+ .filter(|(day, _)| unlocked.contains(day))
378378+ .map(|(day, status)| DayStatus { day, status })
379379+ .collect();
380380+381381+ HtmlTemplate(HomeTemplate {
382382+ title: "at://advent",
383383+ unlocked_days: unlocked_with_status,
384384+ is_logged_in,
385385+ })
386386+}