merge fix

This commit is contained in:
Djairo Hougee 2023-05-08 17:36:42 +02:00
parent b4520509e2
commit 2c56aa0ac2
3 changed files with 3 additions and 11 deletions

View File

@ -4,6 +4,8 @@ use string_builder::Builder;
use crate::structs::{config::{Field, Config}, data::Data}; use crate::structs::{config::{Field, Config}, data::Data};
// TODO: update this function to apply a 'fuzzy' mode instead (possibly add config option).
// This would find the space character nearest the num_chars index and cut off there, allowing for cleaner truncation.
fn cutoff(fields: &Vec<Field>, brk: char, strings: &mut HashMap<String, String>) { fn cutoff(fields: &Vec<Field>, brk: char, strings: &mut HashMap<String, String>) {
for field in fields { for field in fields {
if !field.field.eq("xesam:userRating") && !field.field.eq("xesam:autoRating") { if !field.field.eq("xesam:userRating") && !field.field.eq("xesam:autoRating") {

View File

@ -21,16 +21,6 @@ impl Field {
} }
} }
// I shouldn't need this; remove when done with testing FIXME
impl Default for Field {
fn default() -> Self {
Self {
field: Default::default(),
num_chars: Default::default()
}
}
}
#[derive(Serialize, Deserialize)] #[derive(Serialize, Deserialize)]
pub struct Rating { pub struct Rating {
pub nil: char, pub nil: char,

View File

@ -82,7 +82,7 @@ pub fn update_message(pf: &PlayerFinder, cfg: &Config, data: &mut Data) {
let key = field.field.clone(); let key = field.field.clone();
let string = rating_to_string(m.get(&key), &cfg.rating_icons); let string = rating_to_string(m.get(&key), &cfg.rating_icons);
if let Some(str) = string { if let Some(str) = string {
data.display_text.insert(field.field.clone(), str); data.display_text.insert(key, str);
} else { } else {
data.display_text.remove(&key); data.display_text.remove(&key);
} }