properly select character items based on the latest location
This commit is contained in:
parent
0f7cbbf096
commit
c067ab444a
@ -322,6 +322,13 @@ impl EntityGateway for PostgresGateway {
|
|||||||
join item on item.id = item_location.item
|
join item on item.id = item_location.item
|
||||||
where cast (location -> 'Inventory' ->> 'character_id' as integer) = $1
|
where cast (location -> 'Inventory' ->> 'character_id' as integer) = $1
|
||||||
or cast (location -> 'Bank' ->> 'character_id' as integer) = $1"#;
|
or cast (location -> 'Bank' ->> 'character_id' as integer) = $1"#;
|
||||||
|
let q = r#"select * from (
|
||||||
|
select distinct on (item_location.item) item.id, item_location.location, item.item
|
||||||
|
from item_location join item on item.id = item_location.item
|
||||||
|
order by item_location.item, item_location.created_at desc
|
||||||
|
) as i
|
||||||
|
where cast (location -> 'Inventory' ->> 'character_id' as integer) = 2
|
||||||
|
or cast (location -> 'Bank' ->> 'character_id' as integer) = 2"#;
|
||||||
let items = sqlx::query_as::<_, PgItemWithLocation>(q)
|
let items = sqlx::query_as::<_, PgItemWithLocation>(q)
|
||||||
.bind(char.id.0)
|
.bind(char.id.0)
|
||||||
.fetch(&self.pool);
|
.fetch(&self.pool);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user