makes adding loot working
This commit is contained in:
@@ -138,7 +138,7 @@ impl<'q> AsPlayer<'q> {
|
||||
if let Ok((item, diff)) = self.conn.transaction(|| {
|
||||
use schema::looted::dsl::*;
|
||||
let item = schema::items::table.find(item_id).first::<models::Item>(self.conn)?;
|
||||
let new_item = models::item::NewLoot::to_player(self.id, (&item.name, item.base_price));
|
||||
let new_item = models::item::NewLoot::to_player(self.id, &item);
|
||||
diesel::insert_into(schema::looted::table)
|
||||
.values(&new_item)
|
||||
.execute(self.conn)?;
|
||||
@@ -285,8 +285,8 @@ impl<'q> AsAdmin<'q> {
|
||||
///
|
||||
/// # Params
|
||||
/// List of (name, base_price) values for the new items
|
||||
pub fn add_loot(self, items: Vec<(&str, i32)>) -> ActionResult<()> {
|
||||
for item_desc in items.into_iter() {
|
||||
pub fn add_loot(self, items: Vec<models::item::Item>) -> ActionResult<()> {
|
||||
for item_desc in items.iter() {
|
||||
let new_item = models::item::NewLoot::to_group(item_desc);
|
||||
diesel::insert_into(schema::looted::table)
|
||||
.values(&new_item)
|
||||
|
||||
Reference in New Issue
Block a user