pub fn lookup_match(
    conn: &PgConnection,
    left: &SerenityUser,
    right: &SerenityUser,
) -> Result<Option<Match>> {
    use crate::schema::matches::dsl::*;
    let uleft = lookup_deck(conn, left)?;
    let uright = lookup_deck(conn, right)?;

    if uleft.is_none() || uright.is_none() {
        return Ok(None);
    }

    let (uleft, uright) = (uleft.unwrap(), uright.unwrap());

    let query = matches.filter(
        winning_deck
            .eq(uleft.id)
            .and(losing_deck.eq(uright.id))
            .or(winning_deck.eq(uright.id).and(losing_deck.eq(uleft.id))),
    );

    query.get_result(conn).optional().map_err(|e| e.into())
}
/// Looks up the match between the two given users from the current league.
Looks up the match between the two given users from the current league.
Looks up the match between the two given users from the current league .
pub fn lookup_match(
    conn: &PgConnection,
    left: &SerenityUser,
    right: &SerenityUser,
) -> Result<Option<Match>> {
    use crate::schema::matches::dsl::*;
    let uleft = lookup_deck(conn, left)?;
    let uright = lookup_deck(conn, right)?;
    if uleft.is_none() || uright.is_none() {
        return Ok(None);
    }
    let (uleft, uright) = (uleft.unwrap(), uright.unwrap());
    let query = matches.filter(
        winning_deck
            .eq(uleft.id)
            .and(losing_deck.eq(uright.id))
            .or(winning_deck.eq(uright.id).and(losing_deck.eq(uleft.id))),
    );
    query.get_result(conn).optional().map_err(|e| e.into())
}
pub fn lookup_match ( conn : & PgConnection , left : & SerenityUser , right : & SerenityUser , ) -> Result < Option < Match > > { use crate :: schema :: matches :: dsl :: * ; let uleft = lookup_deck ( conn , left ) ? ; let uright = lookup_deck ( conn , right ) ? ; if uleft . is_none ( ) || uright . is_none ( ) { return Ok ( None ) ; } let ( uleft , uright ) = ( uleft . unwrap ( ) , uright . unwrap ( ) ) ; let query = matches . filter ( winning_deck . eq ( uleft . id ) . and ( losing_deck . eq ( uright . id ) ) . or ( winning_deck . eq ( uright . id ) . and ( losing_deck . eq ( uleft . id ) ) ) , ) ; query . get_result ( conn ) . optional ( ) . map_err ( | e | e . into ( ) ) }
Looks up the match between the two given users from the current league.
Looks up the match between the two given users from the current league .
conn
&PgConnection
left
&SerenityUser
right
&SerenityUser
conn
&PgConnection
left
&SerenityUser
right
&SerenityUser