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

Missing Photos in default Album Listing, even after successful upload PLUS duplication of some other photos #1576

Open
ashwingj opened this issue May 1, 2015 · 4 comments

Comments

@ashwingj
Copy link
Contributor

ashwingj commented May 1, 2015

I created an album containing 96 photos (actually it was 97 and i deleted one). Then i noticed

  • Some of my pictures were missing when i browsed page by page till the end of the album

Other symptoms

  • when i sorted the view the pictures i saw was missing came back
  • in the default view, the count of pictures is correct (both in the label as well as when i manually paged and counted each picture)
  • However i noticed that a couple of pictures repeated themselves in separate pages

Looks like a paging bug.

@ashwingj
Copy link
Contributor Author

ashwingj commented May 9, 2015

On dumping the $filters variable in the ApiPhotoController list_() function I noticed that

  1. On initially clicking on the Album and performing a page load $filter is
{"sortBy":"dateUploaded,desc","album":"7","returnSizes":"960x180,870x870,180x180xCR","__route__":"\/photos\/album-7\/list"}
  1. Scrolling down to the end of the Album causes the incremental load json query, which results in $filter being
{"sortBy":"dateTaken,asc","album":"7","__route__":"\/photos\/album-7\/list.json","returnSizes":"960x180,870x870,180x180xCR","page":"2"}

Surprising that the sortBy is different on the incremental load

@ashwingj
Copy link
Contributor Author

ashwingj commented May 9, 2015

The PhotoController::list_() function seems to want to set 'dateTaken,asc' behaviour when listing an Album OR Tag versus default listing ... See code snippet below

    if($isAlbum || $isTags)
    {
      if(!isset($getParams['sortBy']))
        $additionalParams['sortBy'] = 'dateTaken,asc';

      if($isAlbum)
        $additionalParams['pageSize'] = '0';
    }

This IF condition is however not entered and $isAlbum and $isTag are both raising PHP Notice: Undefined variable errors in the error log. Could this be the problem?

@ashwingj
Copy link
Contributor Author

ashwingj commented May 9, 2015

While looking for client side behaviour, came across this code (4.0.2\tbx.js)

          load: function() {
            var _this = TBX.init.pages.photos, async = typeof(arguments[0]) === 'undefined' ? true : arguments[0], concat = _this.pageLocation.search.length == 0 ? '?' : '&';
            // since sort order for the API is static and onload changes the sort order for albums and gallery we need to mimic the controller behavior in JS
            if(_this.pageLocation.search.search('sortBy') === -1) {
              if(_this.pageLocation.pathname.search('/album-') === -1) // gallery
                _this.pageLocation.search += concat + 'sortBy=dateUploaded,desc';
              else // album
                _this.pageLocation.search += concat + 'sortBy=dateTaken,asc';
            }

            util.load(_this, async);
          },

This looks contrary to the server side code. The 'dateTaken,asc' behaviour is applied only to album listings. Tag listings (/tags-) and gallery listings both default to dateUploaded.

As expected, I cannot reproduce the original bug in either the gallery listing or tag listing as the incremental loads maintain the sorting behaviour of the initial load.

@ashwingj
Copy link
Contributor Author

@jmathai, I can't find where $isAlbum and $isTag are to be set (on the server side). A simple text search of the code did not reveal any place where either of those variables were being assigned. Can you perhaps shed some light?

@ashwingj ashwingj changed the title Missing Photos in default Album Listing, even after successful load PLUS duplication of some other photos Missing Photos in default Album Listing, even after successful upload PLUS duplication of some other photos May 22, 2015
ashwingj added a commit to ashwingj/frontend that referenced this issue Jun 1, 2015
ashwingj added a commit to ashwingj/frontend that referenced this issue Jun 1, 2015
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

1 participant