WILL 100% WORK THIS TIME
This commit is contained in:
@@ -15,19 +15,15 @@ pub fn create_ticket(connection: &mut PgConnection, ticket: NewTicket) {
|
||||
|
||||
pub fn get_tickets(connection: &mut PgConnection, driver_id: i32) -> Vec<CommonTicket> {
|
||||
//Chonky join function for the sake of my life :))
|
||||
let join = tickets::table.left_join(
|
||||
issued_tickets::table.on(tickets::id
|
||||
.eq(issued_tickets::ticket)
|
||||
.and(issued_tickets::driver.eq(driver_id))),
|
||||
);
|
||||
let queried_tickets = join.filter(issued_tickets::driver.eq(driver_id));
|
||||
let queried_tickets = join.select((
|
||||
let join = tickets::table
|
||||
.left_join(issued_tickets::table.on(issued_tickets::driver.eq(driver_id)))
|
||||
.select((
|
||||
tickets::id,
|
||||
tickets::category,
|
||||
tickets::description,
|
||||
tickets::issue_date,
|
||||
)); //only selecting the ticket tho :D
|
||||
let tickets_by_driver = queried_tickets.load::<Ticket>(connection).expect("oh no!");
|
||||
));
|
||||
let tickets_by_driver = join.load::<Ticket>(connection).expect("oh no!");
|
||||
let common_ticket_output = tickets_by_driver
|
||||
.iter()
|
||||
.map(|ticket| CommonTicket {
|
||||
|
||||
Reference in New Issue
Block a user