fixed bug that triggered QueryNoRows on state-toc by adding a default value and improved output when QueryNoRows occurs
This commit is contained in:
		
							parent
							
								
									6611f239f7
								
							
						
					
					
						commit
						1577d5de2e
					
				
					 3 changed files with 9 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -46,6 +46,11 @@ pub const CONFIG: CfgGroup<'static> = CfgGroup {
 | 
			
		|||
            description:
 | 
			
		||||
                "Message-Id of last initial announcement to send In-Reply-To (if applicable).",
 | 
			
		||||
        },
 | 
			
		||||
        CfgField::Default {
 | 
			
		||||
            key: "state-toc",
 | 
			
		||||
            default: "error: no toc saved",
 | 
			
		||||
            description: "Recipient of the emails sent.",
 | 
			
		||||
        },
 | 
			
		||||
    ],
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -80,6 +80,7 @@ impl KeyValueStore {
 | 
			
		|||
            let result = row.get(0)?;
 | 
			
		||||
            Ok(result)
 | 
			
		||||
        } else {
 | 
			
		||||
            println!(": Keinen Wert für '{key}' gefunden, bitte Datenbank überprüfen!");
 | 
			
		||||
            Err(rusqlite::Error::QueryReturnedNoRows)
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -417,7 +417,7 @@ fn do_reminder(
 | 
			
		|||
    NYI!("trace/verbose annotations");
 | 
			
		||||
    // fetch current pad contents & summarize
 | 
			
		||||
    let (current_pad_id, _pad_content, toc, n_topics) = get_pad_info(config, hedgedoc);
 | 
			
		||||
    let old_toc = config.get("state-toc")?;
 | 
			
		||||
    let old_toc = config.get("email-state-toc")?;
 | 
			
		||||
    // construct email
 | 
			
		||||
    let human_date = plenum_day.format("%d.%m.%Y");
 | 
			
		||||
    let subject = if n_topics == 0 {
 | 
			
		||||
| 
						 | 
				
			
			@ -458,6 +458,7 @@ fn do_reminder(
 | 
			
		|||
            "do we skip ahead to ProgramState::Logged here or do we later add a note to the wiki?"
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    config.set("state-name", &ProgramState::Reminded.to_string()).ok();
 | 
			
		||||
    config.set("state-toc", &toc).ok();
 | 
			
		||||
    Ok(())
 | 
			
		||||
| 
						 | 
				
			
			@ -576,7 +577,7 @@ fn do_cleanup(
 | 
			
		|||
    _wiki: &Mediawiki,
 | 
			
		||||
) -> Result<(), Box<dyn Error>> {
 | 
			
		||||
    NYI!("trace/verbose annotations");
 | 
			
		||||
    config.delete("state-toc");
 | 
			
		||||
    config.delete("email-state-toc");
 | 
			
		||||
    config.delete("email-last-message-id");
 | 
			
		||||
    NYI!("rotate pad links");
 | 
			
		||||
    NYI!("double-check state for leftovers");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue