Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug with deleting assets #222

Closed
snipe opened this issue Aug 15, 2014 · 10 comments
Closed

Bug with deleting assets #222

snipe opened this issue Aug 15, 2014 · 10 comments

Comments

@snipe
Copy link
Owner

snipe commented Aug 15, 2014

Start with the demo data in the database.

  1. Delete the last computer asset (Noah MBP)
  2. Create a new computer asset and check it out
  3. Attempt to checkout a software license and assign to the new computer. Fails with "Error: admin/licenses/message.asset_does_not_exist"
  4. Create another new computer asset and check it out
  5. Check out a software license to the new computer. It appears to work but is actually assigned to the asset created in step 2.
@dookie2000ca
Copy link

These are the queries that happen prior to the error:

select * from users where users.deleted_at is null and id = '1' limit 1570μs
select * from throttle where user_id = '1' limit 1310μs
select groups.*, users_groups.user_id as pivot_user_id, users_groups.group_id as pivot_group_id from groups inner join users_groups on groups.id = users_groups.group_id where users_groups.user_id = '1'380μs
select * from assets where assets.deleted_at is null and id = '12' limit 1

The id should be 13, not 12. The DB output shows that 12 was deleted as it should be:

| 12 | Noah MBP | 2014-08-15 13:05:21 |
| 13 | dookbook-air | NULL |

@snipe
Copy link
Owner Author

snipe commented Aug 15, 2014

Thank you for the additional info, @dookie2000ca!

@snipe
Copy link
Owner Author

snipe commented Aug 15, 2014

"Error: admin/licenses/message.asset_does_not_exist" also shows me that we're missing a language string there. :(

snipe added a commit that referenced this issue Aug 15, 2014
@snipe
Copy link
Owner Author

snipe commented Aug 15, 2014

Does the deleted asset show up in the dropdown for the license checkout?

@dookie2000ca
Copy link

No, it's gone from the dropdown and everywhere else.

@snipe
Copy link
Owner Author

snipe commented Aug 15, 2014

Thank you - I think I see what's happening. I think the array index as the array is being built in the controller is being used as the id instead of the ID being used as the ID, which will cause hit or miss results when assigning. Very good catch, I'm sorry for the hassle. :( Working on a fix. (My local dev environment has been facacta recently, but will try to get it back up.)

@dookie2000ca
Copy link

Better to catch it now than later on down the road. I'll keep an eye out for the fix and test it out when it's ready.

@snipe
Copy link
Owner Author

snipe commented Aug 15, 2014

It's exactly as I suspected.

screen shot 2014-08-15 at 7 54 12 pm

@snipe snipe closed this as completed in 49c5607 Aug 16, 2014
@dookie2000ca
Copy link

Confirmed good fix. Thanks for the quick work on it!

@snipe
Copy link
Owner Author

snipe commented Aug 16, 2014

My pleasure - thanks again for the heads up! I hope that didn't cause too many headaches for our users. :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants