Fix insert bug.
This commit is contained in:
parent
ffee522538
commit
c405ef3c57
|
@ -43,8 +43,10 @@ class FeedsController < ApplicationController
|
||||||
end
|
end
|
||||||
insert_idx = 0
|
insert_idx = 0
|
||||||
if time_field_value
|
if time_field_value
|
||||||
insert_idx = feed_annc[:all_contents_for_feed][locale_sym].index{|aa| aa[feeds_time_field] <= time_field_value}
|
insert_idx = feed_annc[:all_contents_for_feed][locale_sym].index{|aa| (aa["org_is_top"] < a["org_is_top"] rescue false) || ((aa["org_is_top"] == a["org_is_top"]) && (aa[feeds_time_field] <= time_field_value))}
|
||||||
insert_idx = 0 if insert_idx.nil?
|
if insert_idx.nil?
|
||||||
|
insert_idx = ((a["org_is_top"] == 1) ? 0 : -1)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
feed_annc.all_contents_for_feed_will_change!
|
feed_annc.all_contents_for_feed_will_change!
|
||||||
feed_annc[:all_contents_for_feed][locale_sym].insert(insert_idx, feed_annc.process_tmp(a,locale,trans,site_root_url))
|
feed_annc[:all_contents_for_feed][locale_sym].insert(insert_idx, feed_annc.process_tmp(a,locale,trans,site_root_url))
|
||||||
|
@ -93,8 +95,10 @@ class FeedsController < ApplicationController
|
||||||
unless has_create
|
unless has_create
|
||||||
insert_idx = 0
|
insert_idx = 0
|
||||||
if time_field_value
|
if time_field_value
|
||||||
insert_idx = feed_annc[:all_contents_for_feed][locale_sym].index{|aa| aa[feeds_time_field] <= time_field_value}
|
insert_idx = feed_annc[:all_contents_for_feed][locale_sym].index{|aa| (aa["org_is_top"] < a["org_is_top"] rescue false) || ((aa["org_is_top"] == a["org_is_top"]) && (aa[feeds_time_field] <= time_field_value))}
|
||||||
insert_idx = 0 if insert_idx.nil?
|
if insert_idx.nil?
|
||||||
|
insert_idx = ((a["org_is_top"] == 1) ? 0 : -1)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
feed_annc.all_contents_for_feed_will_change!
|
feed_annc.all_contents_for_feed_will_change!
|
||||||
feed_annc[:all_contents_for_feed][locale_sym].insert(insert_idx, feed_annc.process_tmp(a,locale,trans,site_root_url))
|
feed_annc[:all_contents_for_feed][locale_sym].insert(insert_idx, feed_annc.process_tmp(a,locale,trans,site_root_url))
|
||||||
|
|
Loading…
Reference in New Issue