Skip to content

Instantly share code, notes, and snippets.

View sidtri's full-sized avatar
🎯
Focusing

sid d sidtri

🎯
Focusing
View GitHub Profile
diff --git a/app/models/concerns/sync_dtd_order.rb b/app/models/concerns/sync_dtd_order.rb
index 8858293..b86328c 100644
--- a/app/models/concerns/sync_dtd_order.rb
+++ b/app/models/concerns/sync_dtd_order.rb
@@ -63,8 +63,8 @@ module SyncDtdOrder
item_ids = items.map{|i| i["id"]}
if item_ids.present?
- order.order_items.where("ext_id not in(?)", item_ids).delete_all
- order.order_exceptions.where("ext_item_id not in(?) and ext_item_id is not null", item_ids).delete_all
diff --git a/app/views/orders/index.js.erb b/app/views/orders/index.js.erb
index 439f038..9888fbd 100644
--- a/app/views/orders/index.js.erb
+++ b/app/views/orders/index.js.erb
@@ -1,3 +1,16 @@
$("#order_lis_container").html("<%= escape_javascript(render partial: 'orders/list_orders',locals: {orders: @orders} ) %>");
-$('.pagination').replaceWith('<%= j paginate(@orders) %>');
\ No newline at end of file
+<% data = j paginate(@orders) %>
diff --git a/app/views/orders/index.js.erb b/app/views/orders/index.js.erb
index 439f038..9888fbd 100644
--- a/app/views/orders/index.js.erb
+++ b/app/views/orders/index.js.erb
@@ -1,3 +1,16 @@
$("#order_lis_container").html("<%= escape_javascript(render partial: 'orders/list_orders',locals: {orders: @orders} ) %>");
-$('.pagination').replaceWith('<%= j paginate(@orders) %>');
\ No newline at end of file
+<% data = j paginate(@orders) %>
diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js
index 0c634d5..1cfcc33 100644
--- a/app/assets/javascripts/application.js
+++ b/app/assets/javascripts/application.js
@@ -59,20 +59,7 @@ $(document).ready(function(){
resetSurveySequences(parentContainer);
});
- var loadOrders = _.debounce(function(){
- var href_tag = $(".pagination a[rel='next']");
diff --git a/app/controllers/reports_controller.rb b/app/controllers/reports_controller.rb
index ecc6ee9..d77ee93 100644
--- a/app/controllers/reports_controller.rb
+++ b/app/controllers/reports_controller.rb
@@ -174,7 +174,8 @@ class ReportsController < ApplicationController
end
def average_delivery_duration
- @date = Date.parse(params[:date]) rescue Date.today
+ # @date = Date.parse(params[:date]) rescue Date.today
diff --git a/app/views/orders/_order_search.html.erb b/app/views/orders/_order_search.html.erb
index f6e0923..2707f70 100644
--- a/app/views/orders/_order_search.html.erb
+++ b/app/views/orders/_order_search.html.erb
@@ -123,7 +123,7 @@ $(function() {
$(".paginate_collection a").on("click",function(e){
e.preventDefault();
var thisObj = $(this);
- $("#page").val( parseInt($.trim(thisObj.text()))||"");
+ $("#page").val( parseInt($.trim(thisObj.text())) || parseInt($.trim(thisObj.attr("href").split("=")[1])) || "");
diff --git a/Gemfile b/Gemfile
index e8d125a..3609fb6 100644
--- a/Gemfile
+++ b/Gemfile
@@ -87,6 +87,7 @@ group :development, :test do
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
+ gem 'pry'
end
diff --git a/app/views/orders/index.js.erb b/app/views/orders/index.js.erb
index 2330fa6..439f038 100644
--- a/app/views/orders/index.js.erb
+++ b/app/views/orders/index.js.erb
@@ -1 +1,3 @@
-$("#order_lis_container").html("<%= escape_javascript(render partial: 'orders/list_orders',locals: {orders: @orders} ) %>");
\ No newline at end of file
+$("#order_lis_container").html("<%= escape_javascript(render partial: 'orders/list_orders',locals: {orders: @orders} ) %>");
+
+$('.pagination').replaceWith('<%= j paginate(@orders) %>');
diff --git a/Gemfile b/Gemfile
index 9903b4f..7cc14f3 100644
--- a/Gemfile
+++ b/Gemfile
@@ -85,6 +85,7 @@ group :development, :test do
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
+ gem 'pry'
end
diff --git a/Gemfile b/Gemfile
index 9903b4f..9fdc912 100644
--- a/Gemfile
+++ b/Gemfile
@@ -62,6 +62,7 @@ gem 'pusher', '~> 0.15.2'
## Env Configurations
gem 'figaro', '~> 1.1', '>= 1.1.1'
+gem 'ransack'