fixing some loops and debug info

This commit is contained in:
Chris Cochrun 2024-03-07 12:04:17 -06:00
parent ca6cccd24d
commit bd78eb4986
2 changed files with 52 additions and 15 deletions

View file

@ -845,10 +845,12 @@ impl slide_model::SlideModel {
// dest slide is 2
//lets get the first slide and count
for (i, slide) in slides_iter
if let Some((i, slide)) = slides_iter
.clone()
.enumerate()
.filter(|slide| slide.1.service_item_id == source_index)
.next()
{
debug!(index = i, ?slide);
first_slide = i as i32;
@ -857,17 +859,18 @@ impl slide_model::SlideModel {
} else {
slide.slide_count
};
break;
}
// lets get the dest_slide and count
if move_down {
for (i, slide) in
slides_iter.clone().enumerate().rev().filter(
|slide| {
if let Some((i, slide)) = slides_iter
.clone()
.enumerate()
.rev()
.filter(|slide| {
slide.1.service_item_id == destination_index
},
)
})
.next()
{
dest_slide = i as i32;
dest_count = if slide.slide_count == 0 {
@ -879,13 +882,14 @@ impl slide_model::SlideModel {
"RUST_dest_slide: {:?} with {:?} slides",
dest_slide, dest_count
);
break;
}
} else {
for (i, slide) in
slides_iter.enumerate().filter(|slide| {
if let Some((i, slide)) = slides_iter
.enumerate()
.filter(|slide| {
slide.1.service_item_id == destination_index
})
.next()
{
dest_slide = i as i32;
dest_count = if slide.slide_count == 0 {
@ -894,8 +898,7 @@ impl slide_model::SlideModel {
slide.slide_count
};
debug!("RUST_dest_slide: {:?}", dest_slide);
break;
}
};
}
debug!(count, first_slide, dest_slide);

View file

@ -495,7 +495,7 @@ impl song_model::SongModel {
if let Some(song) =
self.as_mut().rust_mut().songs.get_mut(index)
{
debug!(?song);
debug!(?song, title = updated_title.to_string());
song.title = updated_title.to_string();
self.as_mut().data_changed(
&model_index,
@ -527,6 +527,10 @@ impl song_model::SongModel {
if let Some(song) =
self.as_mut().rust_mut().songs.get_mut(index)
{
debug!(
?song,
lyrics = updated_lyrics.to_string()
);
song.lyrics = updated_lyrics.to_string();
self.as_mut().data_changed(
&model_index,
@ -559,6 +563,10 @@ impl song_model::SongModel {
if let Some(song) =
self.as_mut().rust_mut().songs.get_mut(index)
{
debug!(
?song,
author = updated_author.to_string()
);
song.author = updated_author.to_string();
self.as_mut().data_changed(
&model_index,
@ -591,6 +599,7 @@ impl song_model::SongModel {
if let Some(song) =
self.as_mut().rust_mut().songs.get_mut(index)
{
debug!(?song, audio = updated_audio.to_string());
song.audio = updated_audio.to_string();
self.as_mut().data_changed(
&model_index,
@ -623,6 +632,7 @@ impl song_model::SongModel {
if let Some(song) =
self.as_mut().rust_mut().songs.get_mut(index)
{
debug!(?song, ccli = updated_ccli.to_string());
song.ccli = updated_ccli.to_string();
self.as_mut().data_changed(
&model_index,
@ -655,6 +665,10 @@ impl song_model::SongModel {
if let Some(song) =
self.as_mut().rust_mut().songs.get_mut(index)
{
debug!(
?song,
verse_order = updated_verse_order.to_string()
);
song.verse_order =
updated_verse_order.to_string();
self.as_mut().data_changed(
@ -730,6 +744,11 @@ impl song_model::SongModel {
if let Some(song) =
self.as_mut().rust_mut().songs.get_mut(index)
{
debug!(
?song,
background_type =
updated_background_type.to_string()
);
song.background_type =
updated_background_type.to_string();
self.as_mut().data_changed(
@ -767,6 +786,12 @@ impl song_model::SongModel {
if let Some(song) =
self.as_mut().rust_mut().songs.get_mut(index)
{
debug!(
?song,
horizontal =
updated_horizontal_text_alignment
.to_string()
);
song.horizontal_text_alignment =
updated_horizontal_text_alignment.to_string();
self.as_mut().data_changed(
@ -804,6 +829,11 @@ impl song_model::SongModel {
if let Some(song) =
self.as_mut().rust_mut().songs.get_mut(index)
{
debug!(
?song,
vertical = updated_vertical_text_alignment
.to_string()
);
song.vertical_text_alignment =
updated_vertical_text_alignment.to_string();
self.as_mut().data_changed(
@ -838,7 +868,7 @@ impl song_model::SongModel {
self.as_mut().rust_mut().songs.get_mut(index)
{
song.font = updated_font.to_string();
debug!(?updated_font);
debug!(?song, font = updated_font.to_string());
self.as_mut().data_changed(
&model_index,
&model_index,
@ -870,6 +900,10 @@ impl song_model::SongModel {
if let Some(song) =
self.as_mut().rust_mut().songs.get_mut(index)
{
debug!(
?song,
font_size = updated_font_size.to_string()
);
song.font_size = updated_font_size;
self.as_mut().data_changed(
&model_index,