snipe-it icon indicating copy to clipboard operation
snipe-it copied to clipboard

Licenses pagination fail

Open mizar1616 opened this issue 12 years ago • 25 comments

Licenses pagination fail, don't show all licenses.

sorry me poor english. Juan J.

mizar1616 avatar Sep 23 '14 19:09 mizar1616

Same here . But all the license are correctly listed in the sql table ...

JulienAerts avatar Oct 01 '14 20:10 JulienAerts

Could you please provide more information as I have not been able to replicate this issue

madd15 avatar Oct 01 '14 23:10 madd15

We also cannot duplicate this error on any of our test/reference systems.

technogenus avatar Oct 02 '14 02:10 technogenus

So i have a lot of license (320 total Licenses ).The total licenses is showing correctly . When i go to the /admin/licenses its only take 250 ( Showing 1 to 50 of 250 entries) . The license are still correctly assign to user or asset .

JulienAerts avatar Oct 02 '14 17:10 JulienAerts

I check if every license was still in the license table ..and it does . when i check some assets i'm still able to see the license checkout to it ...but not listed under the view of /admin/licenses

JulienAerts avatar Oct 02 '14 17:10 JulienAerts

Can you confirm that they're not soft-deleted? (check for deleted_at column)

snipe avatar Oct 02 '14 17:10 snipe

No there not soft-deleted . The field deleted_at are Null where there license not listed in the view .

JulienAerts avatar Oct 02 '14 18:10 JulienAerts

I change my dev platform . From iis microsoft to apache centos . The funny thing is that now have got 259 license listed ...9 licenses were added .(The same database was used ) .

JulienAerts avatar Oct 02 '14 19:10 JulienAerts

The /admin/licenses/9/view is working fine . The licenses with the id 9 is not listed in /admin/licenses/ .Everything seems to be working fine , no error and every other aspect in relation with those licenses seems to be working just fine .

JulienAerts avatar Oct 02 '14 19:10 JulienAerts

which code version/branch are you using?

technogenus avatar Oct 03 '14 05:10 technogenus

This one was the first i tried . v0.3.11-alpha .

I tried this one too: cordeos/snipe-it BETA1

Both are replicating the same issues .

JulienAerts avatar Oct 06 '14 14:10 JulienAerts

I'm currently learning to use the framework laravel , I would like to know the sql query running to populate the /admin/licenses/ view . I'm learning the way to make views and the syntax of blade that's used for template and the controller ect..

For now after some reading in the code ...have found that getIndex Grab all licenses orderBy ( Created_at ... So i checked a license in mySQL DB that was not listed in the view ...i change the value to a later date and reload my page ...and after that i was able to see it .

JulienAerts avatar Oct 06 '14 15:10 JulienAerts

But when i do this ...other Licenses with an older date are dismiss from the view ...

JulienAerts avatar Oct 06 '14 15:10 JulienAerts

@JulienAerts It will be impossible to help without seeing some actual code

snipe avatar Oct 06 '14 16:10 snipe

Ok but i don't have any log or error . The build use is : v0.3.11-alpha .

The code is the same as in the build . In more recent build the bug is still there . Maybe in your own test you dont have enought License added , so that's why you are not able to see the issue . Or maybe all license added was made in the same time ...so you dont have different date in the field create_at .

Have found in LicensesController.php // Grab all the licenses $licenses = License::orderBy('created_at', 'DESC')->paginate(Setting::getSettings()->per_page);

    // Show the page
    return View::make('backend/licenses/index', compact('licenses'));

So that's why i check the created_at field ...but i'm still far from understanding why it's acting like it does .

JulienAerts avatar Oct 06 '14 16:10 JulienAerts

Hi change $licenses = License::orderBy('created_at', 'DESC')->paginate(Setting::getSettings()->per_page); to $licenses = License::orderBy('name', 'DESC')->paginate(Setting::getSettings()->per_page);

Now all my licenses are correctly displayed in my view .

JulienAerts avatar Oct 06 '14 17:10 JulienAerts

So before there was : Showing 1 to 50 of 250 entries and now it's Showing 1 to 50 of 313 entries

JulienAerts avatar Oct 06 '14 17:10 JulienAerts

I hope it's giving you more information to be able to find what's going on . For my part it's resolve ....but i still don't know why it's not working with the order_by created_at ....Like i say before i don't know the framework Laravel ...and i just begin to learn-it to be able to help you more in your project .

JulienAerts avatar Oct 06 '14 17:10 JulienAerts

Would you be able to check in your database to see if somehow some of your licenses have no created_at date, or an incorrect, malformed or unrealistic date (i.e. very far in the past or in the future)?

technogenus avatar Oct 07 '14 09:10 technogenus

I check and every licenses have a correct created_at . The format is the same for all licenses .

This is an example of a created_at field : 2014-08-12 17:06:51

The license from this example was not listed before i make the change in LicensesController.php

Other information: newest created_at : 2014-09-30 19:15:07 oldest ceated_at : 2014-08-12 17:41:23

Like i already mention in a previous post , before i could change only this field from a license and make-it reappear as i change the date to a more recent one .

i'm sure there is some limits or filter that's applied on the sql query otherwise it's not making sense that when i change the order_by created_at to order_by name my issues is resolve .

JulienAerts avatar Oct 07 '14 15:10 JulienAerts