workarea-core 3.4.45 → 3.5.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +52 -0
- data/app/assets/javascripts/workarea/core/modules/duplicate_id.js +1 -5
- data/app/assets/javascripts/workarea/core/modules/style_guide_autocomplete_fields.js +9 -42
- data/app/assets/javascripts/workarea/core/modules/url.js +14 -0
- data/app/controllers/workarea/application_controller.rb +5 -1
- data/app/controllers/workarea/authentication.rb +15 -26
- data/app/controllers/workarea/authorization.rb +3 -3
- data/app/controllers/workarea/current_referrer.rb +1 -2
- data/app/controllers/workarea/current_release.rb +1 -1
- data/app/controllers/workarea/current_segments.rb +52 -0
- data/app/controllers/workarea/current_tracking.rb +45 -0
- data/app/controllers/workarea/http_caching.rb +30 -0
- data/app/controllers/workarea/impersonation.rb +18 -44
- data/app/helpers/workarea/schema_org_helper.rb +21 -0
- data/app/mailers/workarea/application_mailer.rb +2 -4
- data/app/middleware/workarea/application_middleware.rb +44 -0
- data/app/middleware/workarea/query_cache_middleware.rb +55 -0
- data/app/middleware/workarea/release_server_middleware.rb +1 -1
- data/app/models/workarea/application_document.rb +1 -1
- data/app/models/workarea/bulk_action/product_edit.rb +6 -6
- data/app/models/workarea/calculate_percent_change.rb +1 -1
- data/app/models/workarea/catalog/category.rb +0 -2
- data/app/models/workarea/catalog/product.rb +19 -2
- data/app/models/workarea/checkout/collect_payment.rb +10 -1
- data/app/models/workarea/checkout/fraud/analyzer.rb +44 -0
- data/app/models/workarea/checkout/fraud/no_decision_analyzer.rb +14 -0
- data/app/models/workarea/checkout/fraud/test_analyzer.rb +26 -0
- data/app/models/workarea/checkout.rb +18 -6
- data/app/models/workarea/configuration/admin.rb +25 -0
- data/app/models/workarea/configuration/params.rb +45 -0
- data/app/models/workarea/content/asset.rb +5 -18
- data/app/models/workarea/content/block.rb +8 -2
- data/app/models/workarea/content/block_draft.rb +7 -2
- data/app/models/workarea/content/block_type.rb +2 -2
- data/app/models/workarea/content/block_type_definition.rb +4 -0
- data/app/models/workarea/content/preset.rb +1 -1
- data/app/models/workarea/content.rb +12 -82
- data/app/models/workarea/data_file/csv.rb +6 -8
- data/app/models/workarea/data_file/import.rb +9 -1
- data/app/models/workarea/data_file/json.rb +1 -20
- data/app/models/workarea/data_file/operation.rb +0 -4
- data/app/models/workarea/data_file/tax_rates.rb +3 -0
- data/app/models/workarea/featured_products.rb +8 -0
- data/app/models/workarea/fulfillment/policies/base.rb +21 -0
- data/app/models/workarea/fulfillment/policies/download.rb +21 -0
- data/app/models/workarea/fulfillment/policies/ignore.rb +11 -0
- data/app/models/workarea/fulfillment/policies/ship.rb +15 -0
- data/app/models/workarea/fulfillment/sku.rb +72 -0
- data/app/models/workarea/fulfillment/token.rb +36 -0
- data/app/models/workarea/inquiry.rb +1 -2
- data/app/models/workarea/insights/customer_acquisition.rb +5 -9
- data/app/models/workarea/insights/trending_products.rb +2 -2
- data/app/models/workarea/insights/trending_searches.rb +2 -2
- data/app/models/workarea/inventory/collection.rb +30 -0
- data/app/models/workarea/inventory/collection_status.rb +40 -0
- data/app/models/workarea/metrics/affinity.rb +33 -0
- data/app/models/workarea/metrics/country_by_day.rb +4 -0
- data/app/models/workarea/metrics/product_by_day.rb +3 -0
- data/app/models/workarea/metrics/product_by_week.rb +2 -0
- data/app/models/workarea/metrics/product_for_last_week.rb +8 -12
- data/app/models/workarea/metrics/sales_by_day.rb +5 -0
- data/app/models/workarea/metrics/search_by_day.rb +1 -3
- data/app/models/workarea/metrics/search_for_last_week.rb +5 -11
- data/app/models/workarea/metrics/segment_by_day.rb +31 -0
- data/app/models/workarea/metrics/sku_by_day.rb +3 -0
- data/app/models/workarea/metrics/tender_by_day.rb +11 -0
- data/app/models/workarea/metrics/update_user_aggregations.rb +77 -0
- data/app/models/workarea/metrics/user.rb +73 -87
- data/app/models/workarea/navigation/breadcrumbs.rb +10 -1
- data/app/models/workarea/order/fraud_decision.rb +18 -0
- data/app/models/workarea/order/item.rb +5 -0
- data/app/models/workarea/order/queries.rb +1 -0
- data/app/models/workarea/order/status.rb +10 -1
- data/app/models/workarea/order.rb +47 -4
- data/app/models/workarea/payment/credit_card.rb +12 -0
- data/app/models/workarea/payment.rb +7 -2
- data/app/models/workarea/pricing/cache_key.rb +9 -3
- data/app/models/workarea/pricing/calculator.rb +5 -1
- data/app/models/workarea/pricing/calculators/tax_calculator.rb +32 -5
- data/app/models/workarea/pricing/discount/application_group.rb +8 -3
- data/app/models/workarea/pricing/discount/free_gift.rb +2 -1
- data/app/models/workarea/pricing/discount/redemption.rb +1 -1
- data/app/models/workarea/pricing/discount.rb +2 -3
- data/app/models/workarea/pricing/item_tax_applier.rb +41 -0
- data/app/models/workarea/pricing/price.rb +1 -0
- data/app/models/workarea/pricing/request.rb +11 -0
- data/app/models/workarea/pricing/sku.rb +1 -0
- data/app/models/workarea/pricing/tax_application.rb +21 -0
- data/app/models/workarea/pricing/tax_applier.rb +12 -15
- data/app/models/workarea/pricing/unsupported_segmentation.rb +22 -0
- data/app/models/workarea/product_rule.rb +5 -0
- data/app/models/workarea/releasable.rb +83 -89
- data/app/models/workarea/release/activation.rb +45 -0
- data/app/models/workarea/release/changes.rb +45 -0
- data/app/models/workarea/release/changeset.rb +42 -52
- data/app/models/workarea/release/preview.rb +28 -0
- data/app/models/workarea/release/status.rb +2 -24
- data/app/models/workarea/release.rb +72 -99
- data/app/models/workarea/release_session.rb +11 -11
- data/app/models/workarea/search/admin/catalog_product.rb +1 -2
- data/app/models/workarea/search/admin/fulfillment_sku.rb +27 -0
- data/app/models/workarea/search/admin/order.rb +1 -1
- data/app/models/workarea/search/admin/pricing_discount.rb +1 -1
- data/app/models/workarea/search/admin/release.rb +1 -4
- data/app/models/workarea/search/admin/segment.rb +19 -0
- data/app/models/workarea/search/admin.rb +17 -39
- data/app/models/workarea/search/order_text.rb +23 -6
- data/app/models/workarea/search/storefront/category_query.rb +152 -0
- data/app/models/workarea/search/storefront/product/categories.rb +11 -45
- data/app/models/workarea/search/storefront.rb +33 -29
- data/app/models/workarea/segment/first_time_customer.rb +8 -0
- data/app/models/workarea/segment/first_time_visitor.rb +12 -0
- data/app/models/workarea/segment/life_cycle.rb +44 -0
- data/app/models/workarea/segment/loyal_customer.rb +12 -0
- data/app/models/workarea/segment/returning_customer.rb +14 -0
- data/app/models/workarea/segment/returning_visitor.rb +12 -0
- data/app/models/workarea/segment/rules/base.rb +16 -0
- data/app/models/workarea/segment/rules/browser_info.rb +29 -0
- data/app/models/workarea/segment/rules/geolocation.rb +29 -0
- data/app/models/workarea/segment/rules/geolocation_option.rb +53 -0
- data/app/models/workarea/segment/rules/last_order.rb +14 -0
- data/app/models/workarea/segment/rules/logged_in.rb +13 -0
- data/app/models/workarea/segment/rules/orders.rb +17 -0
- data/app/models/workarea/segment/rules/revenue.rb +17 -0
- data/app/models/workarea/segment/rules/sessions.rb +17 -0
- data/app/models/workarea/segment/rules/tags.rb +14 -0
- data/app/models/workarea/segment/rules/traffic_referrer.rb +18 -0
- data/app/models/workarea/segment.rb +54 -0
- data/app/models/workarea/segmentable.rb +66 -0
- data/app/models/workarea/sort.rb +14 -2
- data/app/models/workarea/tax/rate.rb +35 -1
- data/app/models/workarea/user/authorization.rb +19 -13
- data/app/models/workarea/user/login.rb +4 -0
- data/app/models/workarea/user/password_reset.rb +1 -3
- data/app/queries/workarea/categorization.rb +3 -3
- data/app/queries/workarea/featured_categorization.rb +53 -0
- data/app/queries/workarea/order_cancellation_metrics.rb +155 -0
- data/app/queries/workarea/order_item_details.rb +16 -3
- data/app/queries/workarea/order_metrics.rb +32 -3
- data/app/queries/workarea/product_primary_navigation.rb +13 -2
- data/app/queries/workarea/product_releases.rb +38 -0
- data/app/queries/workarea/recommendation/user_activity_based.rb +14 -6
- data/app/queries/workarea/reports/average_order_value.rb +1 -1
- data/app/queries/workarea/reports/customers.rb +14 -11
- data/app/queries/workarea/reports/first_time_vs_returning_sales.rb +1 -1
- data/app/queries/workarea/reports/group_by_time.rb +13 -17
- data/app/queries/workarea/reports/sales_by_category.rb +1 -1
- data/app/queries/workarea/reports/sales_by_country.rb +10 -3
- data/app/queries/workarea/reports/sales_by_discount.rb +1 -1
- data/app/queries/workarea/reports/sales_by_menu.rb +1 -1
- data/app/queries/workarea/reports/sales_by_product.rb +39 -4
- data/app/queries/workarea/reports/sales_by_sku.rb +39 -4
- data/app/queries/workarea/reports/sales_by_tender.rb +42 -0
- data/app/queries/workarea/reports/sales_by_traffic_referrer.rb +1 -1
- data/app/queries/workarea/reports/sales_over_time.rb +10 -3
- data/app/queries/workarea/reports/searches.rb +1 -1
- data/app/queries/workarea/reports/searches_over_time.rb +1 -1
- data/app/queries/workarea/reports/searches_without_results_over_time.rb +1 -1
- data/app/queries/workarea/search/admin_fulfillment_skus.rb +20 -0
- data/app/queries/workarea/search/admin_releases.rb +1 -4
- data/app/queries/workarea/search/admin_search.rb +0 -4
- data/app/queries/workarea/search/admin_segments.rb +16 -0
- data/app/queries/workarea/search/admin_sorting.rb +1 -1
- data/app/queries/workarea/search/pagination.rb +1 -4
- data/app/queries/workarea/search/product_display_rules.rb +40 -8
- data/app/queries/workarea/search/product_entries.rb +15 -1
- data/app/queries/workarea/search/product_search.rb +4 -1
- data/app/queries/workarea/search/storefront_search/exact_matches.rb +1 -1
- data/app/queries/workarea/search/storefront_search/response.rb +6 -4
- data/app/queries/workarea/search/storefront_search.rb +5 -4
- data/app/seeds/workarea/assets_seeds.rb +2 -1
- data/app/seeds/workarea/insights_seeds.rb +0 -23
- data/app/seeds/workarea/orders_seeds.rb +7 -6
- data/app/seeds/workarea/products_seeds.rb +2 -0
- data/app/seeds/workarea/segments_seeds.rb +8 -0
- data/app/seeds/workarea/tax_seeds.rb +3 -3
- data/app/services/workarea/cancel_order.rb +8 -3
- data/app/services/workarea/copy_order.rb +6 -0
- data/app/services/workarea/create_fulfillment.rb +5 -3
- data/app/services/workarea/direct_upload.rb +11 -19
- data/app/services/workarea/hash_update.rb +1 -18
- data/app/services/workarea/packaging.rb +1 -1
- data/app/services/workarea/save_publishing.rb +5 -1
- data/app/workers/sidekiq/callbacks.rb +4 -52
- data/app/workers/sidekiq/callbacks_worker.rb +4 -6
- data/app/workers/workarea/bulk_index_admin.rb +2 -2
- data/app/workers/workarea/bulk_index_products.rb +6 -5
- data/app/workers/workarea/bulk_index_searches.rb +5 -5
- data/app/workers/workarea/deactivate_stale_discounts.rb +3 -3
- data/app/workers/workarea/generate_insights.rb +1 -1
- data/app/workers/workarea/index_admin_search.rb +1 -0
- data/app/workers/workarea/index_categorization.rb +4 -7
- data/app/workers/workarea/index_category.rb +2 -1
- data/app/workers/workarea/index_category_changes.rb +11 -6
- data/app/workers/workarea/index_fulfillment_changes.rb +2 -1
- data/app/workers/workarea/index_help.rb +2 -1
- data/app/workers/workarea/index_page.rb +2 -1
- data/app/workers/workarea/index_payment_transactions.rb +2 -1
- data/app/workers/workarea/index_product.rb +4 -4
- data/app/workers/workarea/index_product_children.rb +4 -3
- data/app/workers/workarea/index_product_rule.rb +3 -2
- data/app/workers/workarea/index_search_customizations.rb +3 -2
- data/app/workers/workarea/index_skus.rb +5 -6
- data/app/workers/workarea/keep_product_index_fresh.rb +3 -5
- data/app/workers/workarea/process_import.rb +3 -3
- data/app/workers/workarea/process_search_recommendations.rb +5 -9
- data/app/workers/workarea/publish_release.rb +1 -0
- data/app/workers/workarea/save_metrics.rb +116 -0
- data/app/workers/workarea/save_order_cancellation_metrics.rb +35 -0
- data/app/workers/workarea/save_order_metrics.rb +10 -74
- data/app/workers/workarea/status_reporter.rb +2 -4
- data/app/workers/workarea/synchronize_user_metrics.rb +17 -0
- data/app/workers/workarea/update_payment_profile_email.rb +22 -0
- data/app/workers/workarea/verify_scheduled_releases.rb +4 -11
- data/config/initializers/00_configuration.rb +185 -0
- data/config/initializers/02_assets.rb +1 -0
- data/config/initializers/05_scheduled_jobs.rb +0 -7
- data/config/initializers/10_rack_middleware.rb +2 -5
- data/config/initializers/11_payment.rb +4 -0
- data/config/initializers/13_rack_attack.rb +2 -4
- data/config/initializers/14_content_block_types.rb +16 -16
- data/config/initializers/15_endpoint_monitoring.rb +3 -6
- data/config/initializers/{21_premailer.rb → 24_premailer.rb} +1 -0
- data/config/initializers/{20_i18n_js.rb → 25_i18n_js.rb} +0 -0
- data/config/locales/en.yml +13 -24
- data/lib/generators/workarea/content_block_type/templates/initializer.rb +1 -1
- data/lib/generators/workarea/install/USAGE +0 -1
- data/lib/generators/workarea/install/install_generator.rb +0 -21
- data/lib/generators/workarea/install/templates/initializer.rb.erb +1 -1
- data/lib/tasks/insights.rake +1 -0
- data/lib/tasks/migrate.rake +106 -0
- data/lib/tasks/search.rake +17 -19
- data/lib/tasks/tests.rake +1 -1
- data/lib/workarea/cache.rb +6 -35
- data/lib/workarea/changelog.rake +2 -2
- data/lib/workarea/configuration/administrable/definition.rb +42 -0
- data/lib/workarea/configuration/administrable/field.rb +79 -0
- data/lib/workarea/configuration/administrable/fieldset.rb +44 -0
- data/lib/workarea/configuration/administrable_options.rb +24 -0
- data/lib/workarea/configuration/cache_store.rb +3 -1
- data/lib/workarea/configuration/content_blocks.rb +17 -0
- data/lib/workarea/configuration/mongoid.rb +1 -4
- data/lib/workarea/configuration/session.rb +36 -0
- data/lib/workarea/configuration/sidekiq.rb +3 -1
- data/lib/workarea/configuration.rb +121 -148
- data/lib/workarea/core/engine.rb +3 -58
- data/lib/workarea/core.rb +15 -11
- data/lib/workarea/elasticsearch/document.rb +8 -15
- data/lib/workarea/ext/freedom_patches/action_view_cache_helper.rb +4 -6
- data/lib/workarea/ext/freedom_patches/active_support_duration.rb +14 -0
- data/lib/workarea/ext/freedom_patches/money.rb +11 -0
- data/lib/workarea/ext/freedom_patches/premailer.rb +6 -0
- data/lib/workarea/ext/freedom_patches/string.rb +19 -4
- data/lib/workarea/ext/mongoid/find_ordered.rb +2 -2
- data/lib/workarea/ext/mongoid/lookup_hash.rb +30 -0
- data/lib/workarea/geolocation.rb +24 -6
- data/lib/workarea/routes_constraints/super_admin.rb +1 -1
- data/lib/workarea/version.rb +3 -4
- data/lib/workarea/visit.rb +92 -0
- data/lib/workarea/warnings.rb +95 -0
- data/lib/workarea.rb +102 -3
- data/test/dummy/config/initializers/session_store.rb +1 -1
- data/test/fixtures/tax_rates.csv +3 -3
- data/test/generators/workarea/content_block_type_generator_test.rb +1 -1
- data/test/generators/workarea/install_generator_test.rb +0 -13
- data/test/integration/workarea/authentication_test.rb +27 -4
- data/test/integration/workarea/authorization_test.rb +5 -0
- data/test/integration/workarea/cache_varies_integration_test.rb +21 -23
- data/test/integration/workarea/monitoring_integration_test.rb +5 -10
- data/test/javascripts/duplicate_id_spec.js +1 -7
- data/test/javascripts/fixtures/{duplicate_id_fail.html.haml → duplicate_id.html.haml} +0 -1
- data/test/javascripts/form_submitting_controls_spec.js +0 -1
- data/test/lib/workarea/asset_endpoints/favicons_test.rb +11 -13
- data/test/lib/workarea/configuration/administrable/definition_test.rb +71 -0
- data/test/lib/workarea/configuration/administrable/field_test.rb +128 -0
- data/test/lib/workarea/configuration/administrable/fieldset_test.rb +78 -0
- data/test/lib/workarea/configuration/configuration_test.rb +20 -0
- data/test/lib/workarea/elasticsearch/document_test.rb +0 -20
- data/test/lib/workarea/elasticsearch/query_cache_test.rb +7 -7
- data/test/lib/workarea/ext/freedom_patches/money_test.rb +11 -0
- data/test/lib/workarea/ext/mongoid/lookup_hash_test.rb +86 -0
- data/test/lib/workarea/geolocation_test.rb +20 -0
- data/test/mailers/workarea/application_mailer_test.rb +1 -11
- data/test/middleware/workarea/query_cache_middleware_test.rb +55 -0
- data/test/models/workarea/checkout/collect_payment_test.rb +14 -6
- data/test/models/workarea/checkout_test.rb +31 -57
- data/test/models/workarea/configuration/params_test.rb +37 -0
- data/test/models/workarea/data_file/csv_test.rb +8 -73
- data/test/models/workarea/data_file/import_test.rb +31 -0
- data/test/models/workarea/data_file/json_test.rb +6 -48
- data/test/models/workarea/data_file/tax_test.rb +3 -0
- data/test/models/workarea/fulfillment/policies/download_test.rb +39 -0
- data/test/models/workarea/fulfillment/sku_test.rb +54 -0
- data/test/models/workarea/insights/best_customers_test.rb +5 -2
- data/test/models/workarea/insights/best_full_price_customers_test.rb +5 -2
- data/test/models/workarea/insights/customer_acquisition_test.rb +1 -1
- data/test/models/workarea/insights/customers_at_risk_test.rb +1 -1
- data/test/models/workarea/insights/low_aov_customers_test.rb +1 -1
- data/test/models/workarea/inventory/collection_test.rb +75 -0
- data/test/models/workarea/metrics/affinity_test.rb +85 -0
- data/test/models/workarea/metrics/product_by_week_test.rb +27 -31
- data/test/models/workarea/metrics/search_by_day_test.rb +3 -0
- data/test/models/workarea/metrics/search_by_week_test.rb +27 -31
- data/test/models/workarea/metrics/update_user_aggregations_test.rb +62 -0
- data/test/models/workarea/metrics/user_test.rb +146 -63
- data/test/models/workarea/navigation/breadcrumbs_test.rb +12 -2
- data/test/models/workarea/order/queries_test.rb +2 -0
- data/test/models/workarea/order_test.rb +44 -0
- data/test/models/workarea/payment/address_test.rb +109 -111
- data/test/models/workarea/payment/credit_card_integration_test.rb +0 -52
- data/test/models/workarea/payment/credit_card_test.rb +5 -0
- data/test/models/workarea/pricing/cache_key_test.rb +7 -1
- data/test/models/workarea/pricing/calculators/tax_calculator_test.rb +41 -1
- data/test/models/workarea/pricing/discount/collection_test.rb +27 -29
- data/test/models/workarea/pricing/discount_test.rb +22 -24
- data/test/models/workarea/pricing/item_tax_applier_test.rb +83 -0
- data/test/models/workarea/pricing/price_test.rb +9 -0
- data/test/models/workarea/pricing/request_test.rb +13 -0
- data/test/models/workarea/pricing/sku_test.rb +9 -0
- data/test/models/workarea/releasable_active_test.rb +113 -0
- data/test/models/workarea/releasable_test.rb +69 -120
- data/test/models/workarea/release/changeset_test.rb +41 -0
- data/test/models/workarea/release_jobs_test.rb +52 -0
- data/test/models/workarea/release_previewing_test.rb +43 -0
- data/test/models/workarea/release_test.rb +59 -153
- data/test/models/workarea/search/admin/content_asset_test.rb +26 -28
- data/test/models/workarea/search/order_text_test.rb +35 -0
- data/test/models/workarea/search/storefront/category_query_test.rb +81 -0
- data/test/models/workarea/search/storefront/product/categories_test.rb +10 -70
- data/test/models/workarea/search/storefront/product_test.rb +10 -11
- data/test/models/workarea/search/storefront_test.rb +1 -13
- data/test/models/workarea/segment/life_cycle_test.rb +24 -0
- data/test/models/workarea/segment/rules/browser_info_test.rb +33 -0
- data/test/models/workarea/segment/rules/geolocation_option_test.rb +16 -0
- data/test/models/workarea/segment/rules/geolocation_test.rb +49 -0
- data/test/models/workarea/segment/rules/last_order_test.rb +32 -0
- data/test/models/workarea/segment/rules/logged_in_test.rb +25 -0
- data/test/models/workarea/segment/rules/orders_test.rb +59 -0
- data/test/models/workarea/segment/rules/revenue_test.rb +59 -0
- data/test/models/workarea/segment/rules/sessions_test.rb +26 -0
- data/test/models/workarea/segment/rules/tags_test.rb +27 -0
- data/test/models/workarea/segment/rules/traffic_referrer_test.rb +31 -0
- data/test/models/workarea/segment_test.rb +80 -0
- data/test/models/workarea/segmentable_test.rb +74 -0
- data/test/models/workarea/shipping/address_test.rb +109 -111
- data/test/models/workarea/shipping/sku_test.rb +8 -12
- data/test/models/workarea/user/password_reset_test.rb +4 -12
- data/test/models/workarea/user_test.rb +13 -10
- data/test/queries/workarea/admin_search_query_wrapper_test.rb +21 -25
- data/test/queries/workarea/categorization_test.rb +49 -0
- data/test/queries/workarea/featured_categorization_test.rb +66 -0
- data/test/queries/workarea/order_cancellation_metrics_test.rb +203 -0
- data/test/queries/workarea/order_item_details_test.rb +17 -0
- data/test/queries/workarea/order_metrics_test.rb +12 -0
- data/test/queries/workarea/product_releases_test.rb +56 -0
- data/test/queries/workarea/recommendation/searches_test.rb +3 -3
- data/test/queries/workarea/recommendation/user_activity_based_test.rb +4 -4
- data/test/queries/workarea/reports/customers_test.rb +12 -8
- data/test/queries/workarea/reports/report_test.rb +4 -6
- data/test/queries/workarea/reports/sales_by_country_test.rb +18 -3
- data/test/queries/workarea/reports/sales_by_product_test.rb +28 -8
- data/test/queries/workarea/reports/sales_by_sku_test.rb +28 -8
- data/test/queries/workarea/reports/sales_by_tender_test.rb +100 -0
- data/test/queries/workarea/reports/sales_by_traffic_referrer_test.rb +6 -6
- data/test/queries/workarea/search/admin_releases_test.rb +1 -26
- data/test/queries/workarea/search/admin_search_test.rb +0 -10
- data/test/queries/workarea/search/admin_users_test.rb +2 -2
- data/test/queries/workarea/search/category_browse_test.rb +53 -0
- data/test/queries/workarea/search/facet_sorting/size_test.rb +11 -13
- data/test/queries/workarea/search/pagination_test.rb +9 -26
- data/test/queries/workarea/search/product_entries_test.rb +27 -0
- data/test/queries/workarea/search/product_search_test.rb +0 -16
- data/test/queries/workarea/search/storefront_search/response_test.rb +26 -0
- data/test/queries/workarea/search/storefront_search_test.rb +34 -36
- data/test/services/workarea/cancel_order_test.rb +27 -13
- data/test/services/workarea/copy_order_test.rb +17 -0
- data/test/services/workarea/direct_upload_test.rb +1 -46
- data/test/services/workarea/export_report_test.rb +41 -45
- data/test/services/workarea/hash_update_test.rb +12 -12
- data/test/services/workarea/packaging_test.rb +9 -11
- data/test/services/workarea/save_publishing_test.rb +23 -0
- data/test/workers/sidekiq/callbacks_test.rb +0 -22
- data/test/workers/workarea/deactivate_stale_discounts_test.rb +2 -2
- data/test/workers/workarea/index_category_changes_test.rb +5 -7
- data/test/workers/workarea/keep_product_index_fresh_test.rb +1 -1
- data/test/workers/workarea/process_import_test.rb +0 -6
- data/test/workers/workarea/process_search_recommendations_test.rb +4 -5
- data/test/workers/workarea/status_reporter_test.rb +2 -1
- data/test/workers/workarea/synchronize_user_metrics_test.rb +57 -0
- data/test/workers/workarea/update_payment_profile_email_test.rb +27 -0
- data/test/workers/workarea/verify_scheduled_releases_test.rb +0 -26
- data/workarea-core.gemspec +13 -11
- metadata +196 -92
- data/app/assets/javascripts/workarea/core/templates/ui_menu_item.jst.ejs +0 -10
- data/app/controllers/workarea/admin_guest_browsing.rb +0 -54
- data/app/middleware/workarea/rack_cache_config_middleware.rb +0 -19
- data/app/queries/workarea/search/search_suggestions.rb +0 -43
- data/app/workers/workarea/bust_discount_cache.rb +0 -16
- data/app/workers/workarea/clean_user_activity.rb +0 -11
- data/app/workers/workarea/undo_release.rb +0 -15
- data/app/workers/workarea/update_email.rb +0 -33
- data/lib/generators/workarea/docker/USAGE +0 -16
- data/lib/generators/workarea/docker/docker_generator.rb +0 -61
- data/lib/generators/workarea/docker/templates/.env.erb +0 -6
- data/lib/generators/workarea/docker/templates/Dockerfile.erb +0 -48
- data/lib/generators/workarea/docker/templates/docker-compose.yml.erb +0 -72
- data/lib/generators/workarea/docker/templates/docker-entrypoint.sh.erb +0 -6
- data/lib/generators/workarea/docker/templates/docker-sync.yml.erb +0 -8
- data/lib/generators/workarea/docker/templates/docker-wait.sh +0 -11
- data/lib/generators/workarea/docker/templates/docker.env +0 -16
- data/lib/generators/workarea/docker/templates/docker_init.rb.erb +0 -29
- data/lib/workarea/configuration/headless_chrome.rb +0 -42
- data/lib/workarea/configuration/puma.rb +0 -37
- data/lib/workarea/ext/freedom_patches/i18n_js.rb +0 -27
- data/lib/workarea/ext/freedom_patches/mongoid_localized_defaults.rb +0 -25
- data/lib/workarea/ext/jbuilder/jbuilder_cache.rb +0 -29
- data/lib/workarea/ext/referer_parser/parser.decorator +0 -43
- data/lib/workarea/queues_pauser.rb +0 -26
- data/lib/workarea/robots.rb +0 -9
- data/test/generators/workarea/docker_generator_test.rb +0 -156
- data/test/javascripts/fixtures/duplicate_id_pass.html.haml +0 -2
- data/test/lib/workarea/ext/freedom_patches/mongoid_localized_defaults_test.rb +0 -25
- data/test/lib/workarea/ext/referer_parser/parser_test.rb +0 -20
- data/test/queries/workarea/search/search_suggestions_test.rb +0 -29
- data/test/workers/workarea/undo_release_test.rb +0 -23
- data/test/workers/workarea/update_email_test.rb +0 -39
@@ -1,34 +1,23 @@
|
|
1
|
+
# This fixes Release::Changes == Mongoid::AuditLog::Changes in development
|
2
|
+
require_dependency 'workarea/release/changes'
|
3
|
+
|
1
4
|
module Workarea
|
2
5
|
class Release
|
3
6
|
class Changeset
|
4
7
|
include ApplicationDocument
|
5
8
|
|
6
9
|
field :changeset, type: Hash, default: {}
|
7
|
-
field :
|
10
|
+
field :original, type: Hash, default: {}
|
11
|
+
field :undo, type: Hash, default: {} # TODO deprecated, remove in v3.6
|
8
12
|
|
9
13
|
embeds_many :document_path, class_name: 'Mongoid::DocumentPath::Node'
|
10
14
|
|
11
15
|
belongs_to :release, class_name: 'Workarea::Release', index: true
|
12
16
|
belongs_to :releasable, polymorphic: true, index: true, optional: true
|
13
17
|
|
14
|
-
index(
|
15
|
-
|
16
|
-
|
17
|
-
)
|
18
|
-
|
19
|
-
# Whether these value changes to this field should be included when
|
20
|
-
# saving a changeset. Used in building changeset hashes.
|
21
|
-
#
|
22
|
-
# @param attribute [String]
|
23
|
-
# @param old_value [Object]
|
24
|
-
# @param new_value [Object]
|
25
|
-
#
|
26
|
-
# @return [Boolean]
|
27
|
-
#
|
28
|
-
def self.track_change?(attribute, old_value, new_value)
|
29
|
-
!attribute.in?(Workarea.config.untracked_release_changes_fields) &&
|
30
|
-
(old_value.present? || new_value.present?)
|
31
|
-
end
|
18
|
+
index({ 'document_path.type' => 1, 'document_path.document_id' => 1 })
|
19
|
+
index('changeset.product_ids' => 1)
|
20
|
+
index('original.product_ids' => 1)
|
32
21
|
|
33
22
|
# Finds changeset by whether the passed document is in the document
|
34
23
|
# path of the changeset. Useful for showing embedded changes in the
|
@@ -61,6 +50,10 @@ module Workarea
|
|
61
50
|
changeset.keys
|
62
51
|
end
|
63
52
|
|
53
|
+
def includes_change?(key, new_value)
|
54
|
+
changed_fields.include?(key) && changeset[key] == new_value
|
55
|
+
end
|
56
|
+
|
64
57
|
# Apply (but do not save) the changes represented by this changeset to
|
65
58
|
# the model passed in.
|
66
59
|
#
|
@@ -73,45 +66,44 @@ module Workarea
|
|
73
66
|
# Make the changes represented by this changeset live. Used when
|
74
67
|
# publishing a release.
|
75
68
|
#
|
76
|
-
# Builds and saves the undo in case that's desired later.
|
77
|
-
#
|
78
69
|
# @return [Boolean]
|
79
70
|
#
|
80
71
|
def publish!
|
81
72
|
return false if releasable_from_document_path.blank?
|
82
73
|
|
83
|
-
build_undo
|
84
74
|
apply_to(releasable_from_document_path)
|
85
75
|
|
86
76
|
releasable_from_document_path.skip_changeset do
|
87
77
|
releasable_from_document_path.save!
|
88
78
|
end
|
89
79
|
|
90
|
-
save!
|
80
|
+
save!
|
91
81
|
end
|
92
82
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
83
|
+
def build_undo(attributes = {})
|
84
|
+
# Ensure the appropriate Release.current for building the undo
|
85
|
+
# This can be nil, which is essential if there is some other arbitrary
|
86
|
+
# release as Release.current.
|
87
|
+
Release.with_current(release.previous) do
|
88
|
+
releasable_from_document_path.reload
|
89
|
+
|
90
|
+
Changeset.new(
|
91
|
+
attributes.reverse_merge(
|
92
|
+
releasable: releasable,
|
93
|
+
document_path: document_path,
|
94
|
+
changeset: changeset.keys.inject({}) do |memo, key|
|
95
|
+
old_value = releasable_from_document_path.attributes[key]
|
96
|
+
new_value = changeset[key]
|
97
|
+
|
98
|
+
memo[key] = old_value if Changes.tracked_change?(key, old_value, new_value)
|
99
|
+
memo
|
100
|
+
end
|
101
|
+
)
|
102
|
+
)
|
103
103
|
end
|
104
|
-
end
|
105
104
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
@releasable_from_document_path =
|
110
|
-
begin
|
111
|
-
Mongoid::DocumentPath.find(document_path)
|
112
|
-
rescue Mongoid::Errors::DocumentNotFound
|
113
|
-
nil
|
114
|
-
end
|
105
|
+
ensure
|
106
|
+
releasable_from_document_path.reload
|
115
107
|
end
|
116
108
|
|
117
109
|
private
|
@@ -123,17 +115,15 @@ module Workarea
|
|
123
115
|
end
|
124
116
|
end
|
125
117
|
|
126
|
-
def
|
127
|
-
|
128
|
-
old_value = model.attributes[key]
|
129
|
-
new_value = changeset[key]
|
118
|
+
def releasable_from_document_path
|
119
|
+
return @releasable_from_document_path if defined?(@releasable_from_document_path)
|
130
120
|
|
131
|
-
|
132
|
-
|
121
|
+
@releasable_from_document_path =
|
122
|
+
begin
|
123
|
+
Mongoid::DocumentPath.find(document_path)
|
124
|
+
rescue Mongoid::Errors::DocumentNotFound
|
125
|
+
nil
|
133
126
|
end
|
134
|
-
|
135
|
-
memo
|
136
|
-
end
|
137
127
|
end
|
138
128
|
end
|
139
129
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Workarea
|
2
|
+
class Release
|
3
|
+
class Preview
|
4
|
+
attr_reader :release
|
5
|
+
|
6
|
+
def initialize(release)
|
7
|
+
@release = release
|
8
|
+
end
|
9
|
+
|
10
|
+
def releases
|
11
|
+
@releases ||= release.scheduled_before + [release]
|
12
|
+
end
|
13
|
+
|
14
|
+
def changesets
|
15
|
+
@changesets ||= releases.flat_map(&:changesets)
|
16
|
+
end
|
17
|
+
|
18
|
+
def changesets_for(model)
|
19
|
+
changesets.select do |changeset|
|
20
|
+
# Check this way because loading the releasable will cause `load_release_changes`
|
21
|
+
# to run this, resulting in a stack overflow.
|
22
|
+
changeset.releasable_type == model.class.name &&
|
23
|
+
changeset.releasable_id.to_s == model.id.to_s
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -5,9 +5,7 @@ module Workarea
|
|
5
5
|
include StatusCalculator::Status
|
6
6
|
|
7
7
|
def in_status?
|
8
|
-
model.publish_at.blank? &&
|
9
|
-
model.published_at.blank? &&
|
10
|
-
model.undo_at.blank?
|
8
|
+
model.publish_at.blank? && model.published_at.blank?
|
11
9
|
end
|
12
10
|
end
|
13
11
|
|
@@ -24,27 +22,7 @@ module Workarea
|
|
24
22
|
include StatusCalculator::Status
|
25
23
|
|
26
24
|
def in_status?
|
27
|
-
model.published_at.present? &&
|
28
|
-
model.publish_at.blank?
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
class Undone
|
33
|
-
include StatusCalculator::Status
|
34
|
-
|
35
|
-
def in_status?
|
36
|
-
model.published_at.present? &&
|
37
|
-
model.undone_at.present?
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
class ScheduledUndo
|
42
|
-
include StatusCalculator::Status
|
43
|
-
|
44
|
-
def in_status?
|
45
|
-
return false unless model.undo_at.present?
|
46
|
-
model.published_at.present? &&
|
47
|
-
model.undo_at >= Time.current
|
25
|
+
model.published_at.present? && model.publish_at.blank?
|
48
26
|
end
|
49
27
|
end
|
50
28
|
end
|
@@ -8,27 +8,25 @@ module Workarea
|
|
8
8
|
field :publish_at, type: Time
|
9
9
|
field :published_at, type: Time
|
10
10
|
field :publish_job_id, type: String
|
11
|
-
field :undo_at, type: Time
|
12
|
-
field :undone_at, type: Time
|
13
|
-
field :undo_job_id, type: String
|
11
|
+
field :undo_at, type: Time # TODO deprecated, remove in v3.6
|
12
|
+
field :undone_at, type: Time # TODO deprecated, remove in v3.6
|
13
|
+
field :undo_job_id, type: String # TODO deprecated, remove in v3.6
|
14
14
|
|
15
15
|
has_many :changesets, class_name: 'Workarea::Release::Changeset'
|
16
|
+
has_one :undo, class_name: 'Workarea::Release', inverse_of: :undoes
|
17
|
+
belongs_to :undoes, class_name: 'Workarea::Release', inverse_of: :undo, optional: true
|
16
18
|
|
17
19
|
index({ publish_at: 1 })
|
18
20
|
index({ published_at: 1 })
|
19
|
-
index({ undo_at: 1 })
|
20
|
-
index({ undone_at: 1 })
|
21
21
|
|
22
22
|
validates :name, presence: true
|
23
23
|
validate :publish_at_status
|
24
|
-
validate :undoable_release, if: :undo_at?
|
25
24
|
|
25
|
+
after_find :reset_preview
|
26
26
|
before_save :remove_publish_job, if: Proc.new { |r| r.publish_at.blank? }
|
27
|
-
before_save :remove_undo_job, if: Proc.new { |r| r.undo_at.blank? }
|
28
27
|
before_save :schedule_publish
|
29
|
-
|
28
|
+
after_save :reset_preview
|
30
29
|
before_destroy :remove_publish_job
|
31
|
-
before_destroy :remove_undo_job
|
32
30
|
|
33
31
|
scope :not_published, (lambda do
|
34
32
|
any_of({ :published_at.exists => false }, { published_at: nil })
|
@@ -36,11 +34,21 @@ module Workarea
|
|
36
34
|
scope :published, (lambda do
|
37
35
|
where(:published_at.exists => true)
|
38
36
|
end)
|
37
|
+
scope :published_between, ->(starts_at: nil, ends_at: nil) do
|
38
|
+
where(
|
39
|
+
:published_at.gte => starts_at,
|
40
|
+
:published_at.lte => ends_at
|
41
|
+
)
|
42
|
+
end
|
39
43
|
scope :not_scheduled, (lambda do
|
40
44
|
any_of({ :publish_at.exists => false }, { publish_at: nil })
|
41
45
|
end)
|
42
|
-
scope :scheduled, ->
|
43
|
-
|
46
|
+
scope :scheduled, ->(before: nil, after: nil) do
|
47
|
+
criteria = where(:publish_at.gt => Time.current)
|
48
|
+
criteria = criteria.where(:publish_at.lte => before) if before.present?
|
49
|
+
criteria = criteria.where(:publish_at.gte => after) if after.present?
|
50
|
+
criteria
|
51
|
+
end
|
44
52
|
scope :soonest, -> { scheduled.asc(:publish_at) }
|
45
53
|
scope :tomorrow, -> do
|
46
54
|
where(
|
@@ -57,15 +65,28 @@ module Workarea
|
|
57
65
|
Thread.current[:current_release] = release
|
58
66
|
end
|
59
67
|
|
60
|
-
def self.with_current(
|
68
|
+
def self.with_current(release)
|
61
69
|
previous = current
|
62
|
-
self.current = release_id.blank? ? nil : find(release_id) rescue nil
|
63
70
|
|
64
|
-
|
71
|
+
new_current = if release.is_a?(Release)
|
72
|
+
release
|
73
|
+
elsif release.present?
|
74
|
+
find(release) rescue nil
|
75
|
+
end
|
76
|
+
|
77
|
+
self.current = new_current
|
78
|
+
current&.reset_preview
|
79
|
+
yield
|
65
80
|
|
66
81
|
ensure
|
67
82
|
self.current = previous
|
68
|
-
|
83
|
+
|
84
|
+
current&.reset_preview
|
85
|
+
previous&.reset_preview
|
86
|
+
end
|
87
|
+
|
88
|
+
def self.without_current(&block)
|
89
|
+
with_current(nil, &block)
|
69
90
|
end
|
70
91
|
|
71
92
|
# Gets a list of unscheduled releases
|
@@ -104,29 +125,12 @@ module Workarea
|
|
104
125
|
results.uniq.sort_by { |r| [r.publish_at || 0, r.published_at || 0] }
|
105
126
|
end
|
106
127
|
|
107
|
-
|
108
|
-
|
109
|
-
#
|
110
|
-
# @ return [Array<Release>]
|
111
|
-
#
|
112
|
-
def self.undone_within(start_date, end_date)
|
113
|
-
results = where(
|
114
|
-
:undo_at.gte => start_date.to_time,
|
115
|
-
:undo_at.lte => end_date.to_time
|
116
|
-
)
|
117
|
-
|
118
|
-
results += where(
|
119
|
-
:undone_at.gte => start_date.to_time,
|
120
|
-
:undone_at.lte => end_date.to_time
|
121
|
-
)
|
122
|
-
|
123
|
-
results.uniq.sort_by { |r| [r.undo_at || 0, r.undone_at || 0] }
|
128
|
+
def self.sort_by_publish
|
129
|
+
scoped.sort_by { |r| [r.publish_at, r.created_at] }
|
124
130
|
end
|
125
131
|
|
126
132
|
def as_current
|
127
|
-
self.class.with_current(
|
128
|
-
yield
|
129
|
-
end
|
133
|
+
self.class.with_current(self) { yield }
|
130
134
|
end
|
131
135
|
|
132
136
|
def scheduled?
|
@@ -141,31 +145,48 @@ module Workarea
|
|
141
145
|
scheduled? || (!scheduled? && !published?)
|
142
146
|
end
|
143
147
|
|
144
|
-
def undone?
|
145
|
-
!!undone_at
|
146
|
-
end
|
147
|
-
|
148
148
|
def has_changes?
|
149
149
|
changesets.present?
|
150
150
|
end
|
151
151
|
|
152
|
-
def
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
152
|
+
def preview
|
153
|
+
@preview ||= Preview.new(self)
|
154
|
+
end
|
155
|
+
|
156
|
+
def reset_preview
|
157
|
+
@preview = nil
|
158
|
+
end
|
159
|
+
|
160
|
+
def scheduled_before
|
161
|
+
return [] unless scheduled?
|
162
|
+
self.class.scheduled(before: publish_at).ne(id: id).sort_by_publish
|
163
|
+
end
|
157
164
|
|
158
|
-
|
159
|
-
|
165
|
+
def scheduled_after
|
166
|
+
return [] unless scheduled?
|
167
|
+
self.class.scheduled(after: publish_at).ne(id: id).sort_by_publish
|
160
168
|
end
|
161
169
|
|
162
|
-
def
|
163
|
-
|
164
|
-
|
170
|
+
def previous
|
171
|
+
scheduled_before.last
|
172
|
+
end
|
173
|
+
|
174
|
+
def build_undo(attributes = {})
|
175
|
+
result = undo || Release.new(attributes)
|
176
|
+
|
177
|
+
result.name ||= I18n.t('workarea.release.undo', name: name)
|
178
|
+
result.tags = %w(undo) if result.tags.blank?
|
179
|
+
self.undo = result
|
180
|
+
|
181
|
+
result
|
182
|
+
end
|
183
|
+
|
184
|
+
def publish!
|
185
|
+
self.published_at = Time.current
|
186
|
+
self.publish_at = nil
|
165
187
|
save!
|
166
188
|
|
167
|
-
|
168
|
-
touch_releasables
|
189
|
+
changesets.each(&:publish!)
|
169
190
|
end
|
170
191
|
|
171
192
|
def set_publish_job
|
@@ -177,15 +198,6 @@ module Workarea
|
|
177
198
|
)
|
178
199
|
end
|
179
200
|
|
180
|
-
def set_undo_job
|
181
|
-
self.undo_job_id = Scheduler.schedule(
|
182
|
-
worker: UndoRelease,
|
183
|
-
at: undo_at,
|
184
|
-
args: [id.to_s],
|
185
|
-
job_id: undo_job_id
|
186
|
-
)
|
187
|
-
end
|
188
|
-
|
189
201
|
# Get all statuses of this release.
|
190
202
|
#
|
191
203
|
# @return [Array<Symbol>]
|
@@ -195,18 +207,6 @@ module Workarea
|
|
195
207
|
StatusCalculator.new(calculators, self).results
|
196
208
|
end
|
197
209
|
|
198
|
-
# Get changesets ordered based on publish priority set by configuration.
|
199
|
-
#
|
200
|
-
# @return [Array<Workarea::Release::Changeset>]
|
201
|
-
#
|
202
|
-
def ordered_changesets
|
203
|
-
ordering = Workarea.config.release_changeset_ordering
|
204
|
-
|
205
|
-
changesets.sort_by do |changeset|
|
206
|
-
ordering[changeset.releasable_type].presence || 999
|
207
|
-
end
|
208
|
-
end
|
209
|
-
|
210
210
|
private
|
211
211
|
|
212
212
|
def publish_at_status
|
@@ -219,38 +219,11 @@ module Workarea
|
|
219
219
|
set_publish_job if publish_at_changed? && publish_at.present?
|
220
220
|
end
|
221
221
|
|
222
|
-
def schedule_undo
|
223
|
-
set_undo_job if undo_at_changed? && undo_at.present?
|
224
|
-
end
|
225
|
-
|
226
222
|
def remove_publish_job
|
227
223
|
return if publish_job_id.blank?
|
228
224
|
|
229
225
|
Scheduler.delete(publish_job_id)
|
230
226
|
self.publish_job_id = nil
|
231
227
|
end
|
232
|
-
|
233
|
-
def remove_undo_job
|
234
|
-
return if undo_job_id.blank?
|
235
|
-
|
236
|
-
Scheduler.delete(undo_job_id)
|
237
|
-
self.undo_job_id = nil
|
238
|
-
end
|
239
|
-
|
240
|
-
def undoable_release
|
241
|
-
unless publish_at.present? || published_at.present?
|
242
|
-
errors.add(:undo_at, I18n.t('workarea.errors.messages.undo_unpublished_release'))
|
243
|
-
end
|
244
|
-
end
|
245
|
-
|
246
|
-
def touch_releasables
|
247
|
-
Sidekiq::Callbacks.disable do
|
248
|
-
changesets
|
249
|
-
.map(&:releasable_from_document_path)
|
250
|
-
.compact
|
251
|
-
.uniq
|
252
|
-
.each(&:touch)
|
253
|
-
end
|
254
|
-
end
|
255
228
|
end
|
256
229
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Workarea
|
2
2
|
class ReleaseSession
|
3
|
-
def initialize(
|
4
|
-
@
|
3
|
+
def initialize(session)
|
4
|
+
@session = session
|
5
5
|
end
|
6
6
|
|
7
7
|
def remind?
|
@@ -9,8 +9,8 @@ module Workarea
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def expired_by_time?
|
12
|
-
@
|
13
|
-
Time.zone.parse(@
|
12
|
+
@session[:release_changed_at].present? &&
|
13
|
+
Time.zone.parse(@session[:release_changed_at]) < timeout
|
14
14
|
end
|
15
15
|
|
16
16
|
def timeout
|
@@ -18,8 +18,8 @@ module Workarea
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def expired_by_page_views?
|
21
|
-
@
|
22
|
-
@
|
21
|
+
@session[:release_page_views].present? &&
|
22
|
+
@session[:release_page_views].to_i > max_page_views
|
23
23
|
end
|
24
24
|
|
25
25
|
def max_page_views
|
@@ -27,19 +27,19 @@ module Workarea
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def save_page_view
|
30
|
-
incremented = @
|
31
|
-
@
|
30
|
+
incremented = @session[:release_page_views].to_i + 1
|
31
|
+
@session[:release_page_views] = incremented
|
32
32
|
end
|
33
33
|
|
34
34
|
def save_release_change
|
35
35
|
reset!
|
36
|
-
@
|
36
|
+
@session[:release_changed_at] = Time.current.to_s
|
37
37
|
end
|
38
38
|
alias_method :touch, :save_release_change
|
39
39
|
|
40
40
|
def reset!
|
41
|
-
@
|
42
|
-
@
|
41
|
+
@session.delete(:release_page_views)
|
42
|
+
@session.delete(:release_changed_at)
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
@@ -80,8 +80,7 @@ module Workarea
|
|
80
80
|
end
|
81
81
|
|
82
82
|
def low_inventory?
|
83
|
-
|
84
|
-
available < Workarea.config.low_inventory_threshold
|
83
|
+
Inventory::Collection.new(model.skus).low_inventory?
|
85
84
|
end
|
86
85
|
|
87
86
|
def variant_missing_details?
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Workarea
|
2
|
+
module Search
|
3
|
+
class Admin
|
4
|
+
class FulfillmentSku < Search::Admin
|
5
|
+
def type
|
6
|
+
'fulfillment_sku'
|
7
|
+
end
|
8
|
+
|
9
|
+
def search_text
|
10
|
+
model.name
|
11
|
+
end
|
12
|
+
|
13
|
+
def jump_to_text
|
14
|
+
"#{model.id} - (#{model.policy})"
|
15
|
+
end
|
16
|
+
|
17
|
+
def jump_to_position
|
18
|
+
12
|
19
|
+
end
|
20
|
+
|
21
|
+
def facets
|
22
|
+
super.merge(policy: model.policy)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|