From 690d9b043d76fab9e206ec140de4160c6623c6cd Mon Sep 17 00:00:00 2001 From: Artemis Date: Thu, 23 Jan 2025 18:13:19 +0100 Subject: [PATCH] chips --- src/db/schema.rs | 16 ++++++++++++++-- templates/show_profile.html.tera | 9 ++++++++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/db/schema.rs b/src/db/schema.rs index 913fcff..66887a2 100644 --- a/src/db/schema.rs +++ b/src/db/schema.rs @@ -19,6 +19,7 @@ pub struct DollProfile { pub pronouns: String, pub handler_name: String, pub handler_url: Option, + pub microchipped: bool, pub kind: Option, pub breed: Option, @@ -27,7 +28,18 @@ pub struct DollProfile { pub chassis_type: Option, pub chassis_id: Option, pub chassis_color: Option, - pub microchipped: bool, +} + +impl DollProfile { + pub fn has_identifying_info(&self) -> bool { + self.kind.is_some() + || self.breed.is_some() + || self.behaviour.is_some() + || self.description.is_some() + || self.chassis_type.is_some() + || self.chassis_id.is_some() + || self.chassis_color.is_some() + } } #[derive(Debug)] @@ -38,6 +50,7 @@ pub struct CreateDollProfile<'a> { pub pronouns: &'a str, pub handler_name: &'a str, pub handler_url: Option<&'a str>, + pub microchipped: bool, pub kind: Option<&'a str>, pub breed: Option<&'a str>, @@ -46,5 +59,4 @@ pub struct CreateDollProfile<'a> { pub chassis_type: Option<&'a str>, pub chassis_id: Option<&'a str>, pub chassis_color: Option<&'a str>, - pub microchipped: bool, } diff --git a/templates/show_profile.html.tera b/templates/show_profile.html.tera index a5d7953..a5d4dc5 100644 --- a/templates/show_profile.html.tera +++ b/templates/show_profile.html.tera @@ -3,7 +3,14 @@ {% block main %}
-

Tag ID {{profile.id}}

+

+ Tag ID {{profile.id}}
+ {% if profile.microchipped %} + Microchipped + {% else %} + Not microchipped + {% endif %} +

{{profile.pronouns}}

{{profile.name}}