fix error

This commit is contained in:
chiu 2020-03-15 12:54:44 +08:00
parent 3d46f147f0
commit 3e0a8cff4d
1 changed files with 1 additions and 2 deletions

View File

@ -80,8 +80,7 @@ class GalleriesController < ApplicationController
album_ids = Album.filter_by_widget_categories.filter_by_tags(tags).pluck(:id) album_ids = Album.filter_by_widget_categories.filter_by_tags(tags).pluck(:id)
params = OrbitHelper.params params = OrbitHelper.params
counts = OrbitHelper.widget_data_count counts = OrbitHelper.widget_data_count
pipeline = [{'$match' => {album_id:{"$in"=>album_ids}}},{'$sort'=>{'_id'=>-1}},{ '$limit' => counts *5 }] images = AlbumImage.where({album_id:{"$in"=>album_ids}}).desc(:id).limit(counts *5).sample(counts)
images = AlbumImage.collection.aggregate(pipeline).sample(counts)
images = images.collect do |a| images = images.collect do |a|
alt_text = (a.description.nil? || a.description == "" ? "gallery image" : a.description) alt_text = (a.description.nil? || a.description == "" ? "gallery image" : a.description)
{ {