Add some fixes and debug stuff
This commit is contained in:
		
							parent
							
								
									45e128361a
								
							
						
					
					
						commit
						3b00001859
					
				
					 3 changed files with 27 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -58,7 +58,7 @@ impl From<&DatabaseError> for String {
 | 
			
		|||
			}
 | 
			
		||||
			DatabaseError::MigrationError(_) => "error on running migrations",
 | 
			
		||||
			DatabaseError::Unknown(_) => "unknown error",
 | 
			
		||||
			DatabaseError::EmptyDataInsert => "empty data was attempted to be inserted",
 | 
			
		||||
			DatabaseError::EmptyDataInsert => "tried to insert empty data",
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -65,6 +65,16 @@ impl FromDbModel for Relay {
 | 
			
		|||
impl Relay {
 | 
			
		||||
	pub fn reload(&mut self, conn: &mut PoolConnection<Sqlite>) -> Result<(), DatabaseError> {
 | 
			
		||||
		self.r = block_on(self.r.reload(conn))?;
 | 
			
		||||
		self.schedules = block_on(DbJunctionRelaySchedule::get_schedules(conn, &self.r))?;
 | 
			
		||||
 | 
			
		||||
		let weekday = utils::get_weekday();
 | 
			
		||||
		self.active_schedule = block_on(DbJunctionRelaySchedule::get_schedule(
 | 
			
		||||
			conn,
 | 
			
		||||
			&self.r,
 | 
			
		||||
			weekday as Weekday,
 | 
			
		||||
		))?
 | 
			
		||||
		.ok_or(DatabaseError::NotFound)?;
 | 
			
		||||
 | 
			
		||||
		Ok(())
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue