pub fn stop_timer<'a>(conn: &'a SqliteConnection, timer_name: &'a str, timer_end_entry: &'a str) -> () {
    use schema::timers::dsl::*;

    let timer = latest_timer(&conn, &timer_name);

    match timer {
        Ok(t) => {
            diesel::update(timers.find(&t.id))
                .set((
                    running.eq(0),
                    end_time.eq(Local::now().timestamp() as i32),
                    end_entry.eq(&timer_end_entry)
                ))
                .execute(conn)
                .expect(&format!("Unable to stop timer {}", &t.id));
        },
        Err(_) => println!("Are you sure a timer is running? Better go catch it.")
    }

}
// stop_timer takes a connection and a name and end_entry string and stops a
// running timer.
stop_timer takes a connection and a name and end_entry string and stops a
running timer.
stop_timer takes a connection and a name and end_entry string and stops a running timer .
pub fn stop_timer<'a>(conn: &'a SqliteConnection, timer_name: &'a str, timer_end_entry: &'a str) -> () {
    use schema::timers::dsl::*;
    let timer = latest_timer(&conn, &timer_name);
    match timer {
        Ok(t) => {
            diesel::update(timers.find(&t.id))
                .set((
                    running.eq(0),
                    end_time.eq(Local::now().timestamp() as i32),
                    end_entry.eq(&timer_end_entry)
                ))
                .execute(conn)
                .expect(&format!("Unable to stop timer {}", &t.id));
        },
        Err(_) => println!("Are you sure a timer is running? Better go catch it.")
    }
}
pub fn stop_timer < ' a > ( conn : & ' a SqliteConnection , timer_name : & ' a str , timer_end_entry : & ' a str ) -> ( ) { use schema :: timers :: dsl :: * ; let timer = latest_timer ( & conn , & timer_name ) ; match timer { Ok ( t ) => { diesel :: update ( timers . find ( & t . id ) ) . set ( ( running . eq ( 0 ) , end_time . eq ( Local :: now ( ) . timestamp ( ) as i32 ) , end_entry . eq ( & timer_end_entry ) ) ) . execute ( conn ) . expect ( & format ! ( " " t id ) ) ; } , Err ( _ ) => println ! ( " " ) } }
stop_timer takes a connection and a name and end_entry string and stops a
running timer.
stop_timer takes a connection and a name and end_entry string and stops a running timer .
conn
&'a SqliteConnection
timer_name
&'a str
timer_end_entry
&'a str
conn
&'a SqliteConnection
timer_name
&'a str
timer_end_entry
&'a str