Merge branch 'master' into 2-0-stable-Feb5

This commit is contained in:
luisramos0
2019-02-05 11:16:23 +00:00
27 changed files with 729 additions and 83 deletions

View File

@@ -39,7 +39,7 @@ before_script:
script:
- 'if [ "$KARMA" = "true" ]; then bundle exec rake karma:run; else echo "Skipping karma run"; fi'
- 'if [ "$RSPEC_ENGINES" = "true" ]; then bundle exec rake openfoodnetwork:specs:engines:rspec; else echo "Skipping RSpec run in engines"; fi'
- 'if [ "$RSPEC_ENGINES" = "true" ]; then bundle exec rake ofn:specs:engines:rspec; else echo "Skipping RSpec run in engines"; fi'
- "bundle exec rake 'knapsack:rspec[--format progress --tag ~performance]'"
after_success:

View File

@@ -75,7 +75,7 @@ Then the main application tests can be run with:
The tests of all custom engines can be run with:
bundle exec rake openfoodnetwork:specs:engines:rspec
bundle exec rake ofn:specs:engines:rspec
Note: If your OS is not explicitly supported in the setup guides then not all tests may pass. However, you may still be able to develop. Get in touch with the [#dev][slack-dev] channel on Slack to troubleshoot issues and determine if they will preclude you from contributing to OFN.

View File

@@ -10,6 +10,7 @@ angular.module("admin.productImport").controller "ImportFormCtrl", ($scope, $htt
$scope.updated_ids = []
$scope.update_errors = []
$scope.batchSize = 50
$scope.step = 'settings'
$scope.chunks = 0
$scope.completed = 0
@@ -51,19 +52,28 @@ angular.module("admin.productImport").controller "ImportFormCtrl", ($scope, $htt
$scope.start = () ->
$scope.started = true
total = ams_data.item_count
size = 50
$scope.chunks = Math.ceil(total / size)
$scope.chunks = Math.ceil(total / $scope.batchSize)
i = 0
# Process only the first batch.
$scope.processBatch($scope.step, 0, $scope.chunks)
while i < $scope.chunks
start = (i*size)+1
end = (i+1)*size
if $scope.step == 'import'
$scope.processImport(start, end)
if $scope.step == 'save'
$scope.processSave(start, end)
i++
$scope.processBatch = (step, batchIndex, batchCount) ->
start = (batchIndex * $scope.batchSize) + 1
end = (batchIndex + 1) * $scope.batchSize
isLastBatch = batchCount == batchIndex + 1
promise = if step == 'import'
$scope.processImport(start, end)
else if step == 'save'
$scope.processSave(start, end)
return if isLastBatch
processNextBatch = ->
$scope.processBatch(step, batchIndex + 1, batchCount)
# Process next batch whether or not processing of the current batch succeeds.
promise.then(processNextBatch, processNextBatch)
$scope.processImport = (start, end) ->
$http(

View File

@@ -7,6 +7,7 @@ de_DE:
shipment_state: Lieferstatus
completed_at: Erfolgt am
number: Nummer
state: Status
email: E-Mail des Kunden
spree/payment:
amount: Betrag
@@ -2591,8 +2592,6 @@ de_DE:
display_as:
display_as: Darstellen als
reports:
table:
select_and_search: "Wählen Sie Filter und klicken Sie auf SEARCH, um auf Ihre Daten zuzugreifen."
bulk_coop:
bulk_coop_supplier_report: 'Massen-Kooperative - Summen nach Anbieter'
bulk_coop_allocation: 'Massenkoop - Zuteilung'

View File

@@ -7,6 +7,7 @@ en_BE:
shipment_state: Shipment State
completed_at: Completed At
number: Number
state: State
email: Customer E-Mail
spree/payment:
amount: Amount
@@ -2599,8 +2600,6 @@ en_BE:
display_as:
display_as: Display As
reports:
table:
select_and_search: "Select filters and click on SEARCH to access your data."
bulk_coop:
bulk_coop_supplier_report: 'Bulk Co-op - Totals by Supplier'
bulk_coop_allocation: 'Bulk Co-op - Allocation'

View File

@@ -7,6 +7,7 @@ en_GB:
shipment_state: Shipment State
completed_at: Completed At
number: Number
state: County
email: Customer E-Mail
spree/payment:
amount: Amount
@@ -2036,6 +2037,8 @@ en_GB:
order_cycles: "Order Cycles"
enterprise_relationships: "Enterprise permissions"
remove_tax: "Remove tax"
first_name_begins_with: "First name begins with"
last_name_begins_with: "Surname begins with"
enterprise_tos_link: "Enterprise Terms of Service link"
enterprise_tos_message: "We want to work with people that share our aims and values. As such we ask new enterprises to agree to our "
enterprise_tos_link_text: "Terms of Service."
@@ -2445,6 +2448,11 @@ en_GB:
orders:
index:
per_page: "%{results} per page"
view_file: View File
compiling_invoices: Compiling Invoices
bulk_invoice_created: Bulk Invoice created
bulk_invoice_failed: Failed to create Bulk Invoice
please_wait: Please wait until the PDF is ready before closing this window.
resend_user_email_confirmation:
resend: "Resend"
sending: "Resend..."
@@ -2547,6 +2555,7 @@ en_GB:
no_orders_found: "No Orders Found"
results_found: "%{number} Results found."
viewing: "Viewing %{start} to %{end}."
print_invoices: "Print Invoices"
invoice:
issued_on: Issued on
tax_invoice: TAX INVOICE

View File

@@ -7,6 +7,7 @@ en_US:
shipment_state: Shipment State
completed_at: Completed At
number: Number
state: State
email: Customer E-mail
spree/payment:
amount: Amount
@@ -475,6 +476,8 @@ en_US:
inventory_no_permission: you do not have permission to create inventory for this producer
none_saved: did not save any products successfully
line_number: "Line %{number}:"
encoding_error: "Please check the language setting of your source file and ensure it is saved with UTF-8 encoding"
unexpected_error: "Product Import encountered an unexpected error when opening the file: %{error_message}"
index:
select_file: Select a spreadsheet to upload
spreadsheet: Spreadsheet
@@ -2034,6 +2037,8 @@ en_US:
order_cycles: "Order Cycles"
enterprise_relationships: "Enterprise permissions"
remove_tax: "Remove tax"
first_name_begins_with: "First name begins with"
last_name_begins_with: "Last name begins with"
enterprise_tos_link: "Enterprise Terms of Service link"
enterprise_tos_message: "We want to work with people that share our aims and values. As such we ask new enterprises to agree to our "
enterprise_tos_link_text: "Terms of Service."
@@ -2437,6 +2442,11 @@ en_US:
orders:
index:
per_page: "%{results} per page"
view_file: View File
compiling_invoices: Compiling Invoices
bulk_invoice_created: Bulk Invoice created
bulk_invoice_failed: Failed to create Bulk Invoice
please_wait: Please wait until the PDF is ready before closing this window.
resend_user_email_confirmation:
resend: "Resend"
sending: "Resend..."
@@ -2539,6 +2549,7 @@ en_US:
no_orders_found: "No Orders Found"
results_found: "%{number} Results found."
viewing: "Viewing %{start} to %{end}."
print_invoices: "Print Invoices"
invoice:
issued_on: Issued on
tax_invoice: TAX INVOICE
@@ -2618,7 +2629,7 @@ en_US:
display_as: Display As
reports:
table:
select_and_search: "Select filters and click on SEARCH to access your data."
select_and_search: "Select filters and click on %{option} to access your data."
bulk_coop:
bulk_coop_supplier_report: 'Bulk Co-op - Totals by Supplier'
bulk_coop_allocation: 'Bulk Co-op - Allocation'

View File

@@ -7,6 +7,7 @@ es:
shipment_state: Estado del envío
completed_at: Completado en
number: Número
state: Provincia
email: E-mail del consumidor
spree/payment:
amount: Cantidad
@@ -2623,8 +2624,6 @@ es:
display_as:
display_as: Mostrar como
reports:
table:
select_and_search: "Selecciona filtros y haz clic en BUSCAR para acceder a tus datos."
bulk_coop:
bulk_coop_supplier_report: 'Bulk Co-op - Totales por Proveedor'
bulk_coop_allocation: 'Bulk Co-op - Asignación'

View File

@@ -7,6 +7,7 @@ fr:
shipment_state: Statut livraison
completed_at: 'Passée à '
number: N° commande
state: Département
email: Email acheteur
spree/payment:
amount: Montant
@@ -475,6 +476,8 @@ fr:
inventory_no_permission: vous n'avez pas l'autorisation d'ajouter les produits de ce producteur à votre catalogue boutique
none_saved: n'a pu sauvegarder aucun produit :-(
line_number: "Ligne %{number} :"
encoding_error: "Veuillez vérifier le paramètre de langue de votre code source et vous assurer qu'il est encodé en UTF-8"
unexpected_error: "L'import de fichier produits à rencontré une erreur inconnue à l'ouverture du fichier : %{error_message}"
index:
select_file: Sélectionner le fichier (tableur sous format csv) à importer
spreadsheet: Tableur csv
@@ -2035,6 +2038,8 @@ fr:
order_cycles: "Cycles de Vente"
enterprise_relationships: "Permissions inter-entreprises"
remove_tax: "Retirer TVA"
first_name_begins_with: "Prénom commence par"
last_name_begins_with: "Nom de famille commence par"
enterprise_tos_link: "Lien vers les Conditions Générales d'Utilisation"
enterprise_tos_message: "Nous soutenons la mise en place d'un système alimentaire résilient et durable, et souhaitons œuvrer avec des entreprises qui partagent nos valeurs et notre vision. Ainsi, nous demandons aux entreprises s'enregistrant sur Open Food France de valider nos "
enterprise_tos_link_text: "Conditions d'utilisation"
@@ -2448,6 +2453,11 @@ fr:
orders:
index:
per_page: "%{results} par page"
view_file: Voir le fichier
compiling_invoices: Compilation des factures en cours
bulk_invoice_created: Facture compilée générée
bulk_invoice_failed: Échec dans la compilation des factures
please_wait: Veuillez attendre que le PDF soit prêt avant de fermer cette fenêtre.
resend_user_email_confirmation:
resend: "Renvoyer"
sending: "Renvoi...."
@@ -2551,6 +2561,7 @@ fr:
no_orders_found: "Aucune commande trouvée pour ces critères"
results_found: "%{number} résultats trouvés"
viewing: "Résultats %{start} à %{end} affichés."
print_invoices: "Imprimer les factures"
invoice:
issued_on: Editée le
tax_invoice: FACTURE
@@ -2630,7 +2641,7 @@ fr:
display_as: Unité affichéé
reports:
table:
select_and_search: "Sélectionnez les filtres et cliquez sur RECHERCHER pour accéder à vos données."
select_and_search: "Sélectionner les filtres et cliquez sur %{option} pour accéder aux données."
bulk_coop:
bulk_coop_supplier_report: 'Achats groupés - Totaux par Producteur'
bulk_coop_allocation: 'Achats groupés - Allocation'

View File

@@ -7,6 +7,7 @@ fr_BE:
shipment_state: Statut livraison
completed_at: 'Passée à '
number: N° commande
state: Province
email: Adresse électronique acheteur
spree/payment:
amount: Montant
@@ -2616,8 +2617,6 @@ fr_BE:
display_as:
display_as: Unité affichéé
reports:
table:
select_and_search: "Sélectionnez les filtres et cliquez sur RECHERCHER pour accéder à vos données."
bulk_coop:
bulk_coop_supplier_report: 'Achats groupés - Totaux par Producteur'
bulk_coop_allocation: 'Achats groupés - Allocation'

View File

@@ -7,6 +7,7 @@ fr_CA:
shipment_state: Statut de la livraison
completed_at: 'Passée à '
number: N° commande
state: Département
email: Email acheteur
spree/payment:
amount: Montant
@@ -24,6 +25,11 @@ fr_CA:
attributes:
orders_close_at:
after_orders_open_at: doit être après la date d'ouverture
variant_override:
count_on_hand:
using_producer_stock_settings_but_count_on_hand_set: "doit être vide car utilise les informations de stock du producteur"
on_demand_but_count_on_hand_set: "doit être vide si \"à volonté\""
limited_stock_but_no_count_on_hand: "doit être spécifié car pas \"à volonté\""
activemodel:
errors:
models:
@@ -55,6 +61,7 @@ fr_CA:
user_registrations:
spree_user:
signed_up_but_unconfirmed: "Un message avec un lien de confirmation a été envoyé à l'adresse email indiquée. Veuillez cliquer sur ce lien pour activer votre compte."
unknown_error: "Une erreur s'est glissée lors de la création de votre compte. Vérifiez votre addresse email et recommencez."
failure:
invalid: |
Email / mot de passe incorrect.
@@ -195,6 +202,7 @@ fr_CA:
admin_and_handling: Admin et gestion
profile: Profil
supplier_only: Uniquement Fournisseur
has_shopfront: gère une boutique
weight: Poids
volume: Volume
items: Pièces
@@ -216,6 +224,10 @@ fr_CA:
quantity: Quantité
pick_up: Retrait
copy: Copier
password_confirmation: Confirmation de mot de passe
reset_password_token: La demande de réinitialisation du mot de passe
expired: a expiré, veuillez faire une nouvelle demande.
back_to_payments_list: "Retour à la liste des paiements"
actions:
create_and_add_another: "Créer et ajouter nouveau"
admin:
@@ -459,10 +471,14 @@ fr_CA:
conditional_blank: Champ obligatoire si le type d'unité est vide
no_product: 'aucun produit trouvé '
not_found: n'a pas été trouvé dans la base de donnée
not_updatable: ne peut pas être mis à jour pour des produits existants via la fonctionnalité d'import de fichier produits
blank: Champ obligatoire
products_no_permission: vous n'avez pas les droits requis pour gérer les produits de cette entreprise
inventory_no_permission: Vous n'avez pas la permission de créer un catalogue boutique pour ce producteur
none_saved: n'a pu sauvegarder aucun produit :-(
line_number: "Ligne :%{number}"
encoding_error: "Veuillez vérifier le paramètre de langue de votre code source et vous assurer qu'il est encodé en UTF-8"
unexpected_error: "L'import de fichier produits à rencontré une erreur inconnue à l'ouverture du fichier : %{error_message}"
index:
select_file: Sélectionner une feuille de calcul à uploader
spreadsheet: Feuille de calcul
@@ -496,6 +512,7 @@ fr_CA:
no_permission: vous n'avez pas les droits requis pour gérer les produits de cette entreprise
not_found: entreprise non trouvée dans la base de donnée
no_name: Pas de nom
blank_enterprise: certains produits n'ont pas d'entreprise associée
reset_absent?: Mettre à zéro le produits absents du fichier
reset_absent_tip: Remettre le sock à zero pour les produits non présents dans le fichier.
overwrite_all: Modifier tous
@@ -515,6 +532,11 @@ fr_CA:
inventory_to_reset: Les produits du catalogue boutique auront leurs stocks remis à zéro
line: Ligne
item_line: 'Ligne produit '
import_review:
not_updatable_tip: "Les champs suivants ne peuvent pas être mis à jour pour des produits existants via la fonctionnalité d'import de fichier produits :"
fields_ignored: Ces champs seront ignorés à l'enregistrement des produits importés.
entries_table:
not_updatable: Ce champs ne peut pas être mis à jour pour des produits existants via la fonctionnalité d'import de fichier produits
save_results:
final_results: 'Importer les derniers résultats '
products_created: Produits crées
@@ -561,6 +583,7 @@ fr_CA:
tip: "Utilisez cette page pour changer les quantités d'un produit sur plusieurs commandes. Les produits peuvent aussi être supprimés de toutes les commandes, si nécessaire."
shared: "Ressource partagée?"
order_no: "N° commande"
order_date: "Passée le"
max: "Max"
product_unit: "Produit: Unité"
weight_volume: "Poids/Volume"
@@ -702,7 +725,9 @@ fr_CA:
close_date: Date de fermeture
social:
twitter_placeholder: ex. @OpenFoodNet_fr
instagram_placeholder: ex. @OpenFoodNet_fr
facebook_placeholder: 'ex: www.facebook.com/NomDeLaPage'
linkedin_placeholder: 'ex: www.linkedin.com/VotreNom'
stripe_connect:
connect_with_stripe: "Connecter avec Stripe"
stripe_connect_intro: "Pour accepter des paiements utilisant la carte bancaire, vous devez connecter votre compte Stripe à Open Food Network. Cliquez sur le bouton à droite pour commencer."
@@ -1142,7 +1167,9 @@ fr_CA:
menu_5_title: "A propos"
menu_5_url: "http://www.openfoodnetwork.org"
menu_6_title: "Se connecter"
menu_6_url: "https://openfoodnetwork.org/au/connect/"
menu_7_title: "Apprendre"
menu_7_url: "https://openfoodnetwork.org/au/learn/"
logo: "Logo (640x130)"
logo_mobile: "Logo smartphone (75x26)"
logo_mobile_svg: "Logo smartphone (SVG)"
@@ -2011,6 +2038,8 @@ fr_CA:
order_cycles: "Cycles de Vente"
enterprise_relationships: "Permissions Inter-entreprises"
remove_tax: "Retirer taxe"
first_name_begins_with: "Prénom commence par"
last_name_begins_with: "Nom de famille commence par"
enterprise_tos_link: "Lien vers les Conditions Générales d'Utilisation"
enterprise_tos_message: "Nous soutenons la mise en place d'un système alimentaire résilient et durable, et souhaitons œuvrer avec des entreprises qui partagent nos valeurs et notre vision. Ainsi, nous demandons aux entreprises s'enregistrant sur Open Food Network de valider nos "
enterprise_tos_link_text: "Conditions d'utilisation"
@@ -2225,6 +2254,7 @@ fr_CA:
validation_msg_relationship_already_established: "^Un lien est déjà établi."
validation_msg_at_least_one_hub: "^Sélectionnez au moins un hub"
validation_msg_product_category_cant_be_blank: "^Veuillez sélectionner la catégorie produit"
validation_msg_tax: "^La TVA applicable est requise"
validation_msg_tax_category_cant_be_blank: "^Veuillez sélectionner le type de taxe"
validation_msg_is_associated_with_an_exising_customer: "est associé à un acheteur existant"
content_configuration_pricing_table: "(A FAIRE : Tableau des tarifs)"
@@ -2420,6 +2450,14 @@ fr_CA:
resolve: Résoudre
new_tag_rule_dialog:
select_rule_type: "Choisir le type de règle:"
orders:
index:
per_page: " %{results}par page"
view_file: Voir le fichier
compiling_invoices: Compilation des factures en cours
bulk_invoice_created: Facture compilée générée
bulk_invoice_failed: Échec dans la compilation des factures
please_wait: Veuillez attendre que le PDF soit prêt avant de fermer cette fenêtre.
resend_user_email_confirmation:
resend: "Renvoyer"
sending: "Renvoyer"
@@ -2438,6 +2476,7 @@ fr_CA:
'yes': "A volonté"
variant_overrides:
on_demand:
use_producer_settings: "Utiliser les infos de stock producteur"
'yes': "Oui"
'no': "Non"
inventory_products: "Produits du Catalogue Boutique"
@@ -2508,11 +2547,21 @@ fr_CA:
inherits_properties_checkbox_hint: "Hériter des propriétés de %{supplier}? (non applicable si information de remplacement déjà saisie)"
orders:
index:
listing_orders: "Liste des commandes"
new_order: "Nouvelle commande"
capture: "Payée"
ship: "Expédier"
edit: "Modifier"
note: "Note"
first: "Début"
last: "Fin"
previous: "Précédent"
next: "Suivant"
loading: "Chargement en cours"
no_orders_found: "Aucune commande trouvée"
results_found: " %{number}résultats trouvés"
viewing: "Résultats %{start} à %{end}affichés."
print_invoices: "Imprimer les factures"
invoice:
issued_on: Editée le
tax_invoice: FACTURE
@@ -2534,6 +2583,12 @@ fr_CA:
other: "Vous avez %{count} cycles de vente actifs."
manage_order_cycles: "GERER LES CYCLES DE VENTE"
payment_methods:
new:
new_payment_method: "Nouvelle méthode de paiement"
back_to_payment_methods_list: "Retour à la liste des méthodes de paiement"
edit:
editing_payment_method: "Modification de la méthode de paiement"
back_to_payment_methods_list: "Retour à la liste des méthodes de paiement"
stripe_connect:
enterprise_select_placeholder: Choisir...
loading_account_information_msg: Informations de compte en cours de chargement depuis Stripe, veuillez patienter...
@@ -2586,7 +2641,7 @@ fr_CA:
display_as: Unité affichéé
reports:
table:
select_and_search: "Sélectionner les filtres et cliquez sur RECHERCHER pour accéder aux données."
select_and_search: "Sélectionner les filtres et cliquez sur %{option}pour accéder aux données."
bulk_coop:
bulk_coop_supplier_report: 'Achats groupés - Totaux par Producteur'
bulk_coop_allocation: 'Achats groupés - Allocation'
@@ -2594,14 +2649,21 @@ fr_CA:
bulk_coop_customer_payments: 'Achats groupés - Paiement des acheteurs'
users:
index:
listing_users: "Liste des utilisateurs"
new_user: "Nouvel utilisateur"
user: "Utilisateur"
enterprise_limit: "Nombre max d'entreprises"
search: "Chercher"
email: "Email"
edit:
editing_user: "Modifier l'utilisateur"
back_to_users_list: "Retour à la liste utilisateurs"
general_settings: "Configurations générales"
form:
email: "Email"
roles: "Roles"
enterprise_limit: "Nombre max d'entreprises"
confirm_password: "Confirmez votre mot de passe"
password: "Mot de passe"
email_confirmation:
confirmation_pending: "L'email de confirmation n'a pas encore été validé. Il a été envoyé à %{address}."

File diff suppressed because it is too large Load Diff

View File

@@ -7,6 +7,7 @@ nb:
shipment_state: Leveringsstatus
completed_at: Fullført på
number: Nummer
state: Tilstand
email: Epost Kunde
spree/payment:
amount: Beløp
@@ -2036,6 +2037,8 @@ nb:
order_cycles: "Bestillingsrunder"
enterprise_relationships: "Bedriftsrettigheter"
remove_tax: "Fjern avgift"
first_name_begins_with: "Fornavn begynner med"
last_name_begins_with: "Etternavn begynner med"
enterprise_tos_link: "Lenke til Tjenestevilkår for Bedrifter"
enterprise_tos_message: "Vi ønsker å jobbe med bedrifter som deler våre mål og verdier. Derfor ber vi nye bedrifter om å godta vår"
enterprise_tos_link_text: "Tjenestevilkår."
@@ -2439,6 +2442,11 @@ nb:
orders:
index:
per_page: "%{results} per side"
view_file: Se fil
compiling_invoices: Samler Fakturaer
bulk_invoice_created: Samlefaktura opprettet
bulk_invoice_failed: Kunne ikke opprette samlefaktura
please_wait: Vennligst vent til PDF-filen er klar før du lukker dette vinduet.
resend_user_email_confirmation:
resend: "Send på nytt"
sending: "Send på nytt ..."
@@ -2540,6 +2548,7 @@ nb:
no_orders_found: "Ingen bestillinger funnet"
results_found: "%{number} Resultater funnet."
viewing: "Ser %{start} til %{end}."
print_invoices: "Skriv ut fakturaer"
invoice:
issued_on: Utstedt på
tax_invoice: AVGIFTSFAKTURA

View File

@@ -7,6 +7,7 @@ pt:
shipment_state: Estado do envio
completed_at: Concluído Em
number: Número
state: Região
email: Email do/a Consumidor/a
spree/payment:
amount: Quantia
@@ -2488,8 +2489,6 @@ pt:
display_as:
display_as: Mostrar como
reports:
table:
select_and_search: "Selecione os filtros e click em Pesquisar para obter resultados."
bulk_coop:
bulk_coop_supplier_report: 'Cooperativa por Atacado - Totais por Fornecedor'
bulk_coop_allocation: 'Cooperativa por Atacado - Alocação'

View File

@@ -5,6 +5,7 @@ sv:
spree/order:
payment_state: Betalningstatus
shipment_state: Leveransstatus
state: Region
errors:
models:
spree/user:

View File

@@ -13,7 +13,7 @@ job_type :enqueue_job, "cd :path; :environment_variable=:environment bundle exe
every 1.hour do
rake 'openfoodnetwork:cache:check_products_integrity'
rake 'ofn:cache:check_products_integrity'
end
every 1.day, at: '12:05am' do
@@ -35,10 +35,10 @@ every 5.minutes do
end
every 1.day, at: '1:00am' do
rake 'openfoodnetwork:billing:update_account_invoices'
rake 'ofn:billing:update_account_invoices'
end
# On the 2nd of every month at 1:30am
every '30 1 2 * *' do
rake 'openfoodnetwork:billing:finalize_account_invoices'
rake 'ofn:billing:finalize_account_invoices'
end

View File

@@ -1,4 +1,4 @@
namespace :openfoodnetwork do
namespace :ofn do
namespace :billing do
desc 'Update enterprise user invoices'
task update_account_invoices: :environment do

View File

@@ -1,6 +1,6 @@
require 'open_food_network/products_cache_integrity_checker'
namespace :openfoodnetwork do
namespace :ofn do
namespace :cache do
desc 'check the integrity of the products cache'
task :check_products_integrity => :environment do

View File

@@ -1,4 +1,4 @@
namespace :openfoodnetwork do
namespace :ofn do
namespace :data do
desc "Adding relationships based on recent order cycles"
task :create_order_cycle_relationships => :environment do

View File

@@ -1,4 +1,4 @@
namespace :openfoodnetwork do
namespace :ofn do
namespace :dev do
desc 'load sample data'
task load_sample_data: :environment do

View File

@@ -1,6 +1,6 @@
require 'csv'
namespace :openfoodnetwork do
namespace :ofn do
namespace :dev do
desc 'export enterprises to CSV'
task :export_enterprises => :environment do

View File

@@ -1,4 +1,4 @@
namespace :openfoodnetwork do
namespace :ofn do
namespace :specs do
namespace :engines do
def detect_engine_paths

View File

@@ -52,7 +52,7 @@ printf '\n\n' | bundle exec rake db:setup db:test:prepare
printf '\n'
# Load some default data for your environment
bundle exec rake openfoodnetwork:dev:load_sample_data
bundle exec rake ofn:dev:load_sample_data
printf '\n'
printf "${YELLOW}WELCOME TO OPEN FOOD NETWORK!\n"

View File

@@ -11,7 +11,9 @@ module Api
let!(:distributor2) { create(:distributor_enterprise) }
let!(:supplier) { create(:supplier_enterprise) }
let!(:coordinator) { create(:distributor_enterprise) }
let!(:coordinator2) { create(:distributor_enterprise) }
let!(:order_cycle) { create(:simple_order_cycle, coordinator: coordinator) }
let!(:order_cycle2) { create(:simple_order_cycle, coordinator: coordinator2) }
let!(:order1) do
create(:order, order_cycle: order_cycle, state: 'complete', completed_at: Time.zone.now,
distributor: distributor, billing_address: create(:address) )
@@ -24,7 +26,9 @@ module Api
create(:order, order_cycle: order_cycle, state: 'complete', completed_at: Time.zone.now,
distributor: distributor, billing_address: create(:address) )
end
let!(:order4) { create(:completed_order_with_fees, distributor: distributor) }
let!(:order4) do
create(:completed_order_with_fees, order_cycle: order_cycle2, distributor: distributor2)
end
let!(:order5) { create(:order, state: 'cart', completed_at: nil) }
let!(:line_item1) do
create(:line_item_with_shipment, order: order1,
@@ -142,7 +146,7 @@ module Api
get :index, per_page: 15, page: 1
pagination_data = {
'results' => 3,
'results' => 2,
'pages' => 1,
'page' => 1,
'per_page' => 15

View File

@@ -99,6 +99,7 @@ feature %q{
click_link 'Enterprises'
click_link 'Test Enterprise'
within('.side_menu') { click_link 'Users' }
expect(page).to have_selector "table.managers"
end
it "lists managers and shows icons for owner, contact, and email confirmation" do

View File

@@ -35,8 +35,7 @@ feature "Managing enterprise images" do
go_to_images
within ".page-admin-enterprises-form__logo-field-group" do
expect(page).to have_selector(".image-field-group__preview-image")
expect(html).to include("logo-white.png")
expect_preview_image "logo-white.png"
end
# Replacing image
@@ -47,8 +46,7 @@ feature "Managing enterprise images" do
go_to_images
within ".page-admin-enterprises-form__logo-field-group" do
expect(page).to have_selector(".image-field-group__preview-image")
expect(html).to include("logo-black.png")
expect_preview_image "logo-black.png"
end
# Removing image
@@ -60,7 +58,7 @@ feature "Managing enterprise images" do
expect(page).to have_content("Logo removed successfully")
within ".page-admin-enterprises-form__logo-field-group" do
expect(page).to have_no_selector(".image-field-group__preview-image")
expect_no_preview_image
end
end
@@ -73,8 +71,7 @@ feature "Managing enterprise images" do
go_to_images
within ".page-admin-enterprises-form__promo-image-field-group" do
expect(page).to have_selector(".image-field-group__preview-image")
expect(html).to include("logo-white.jpg")
expect_preview_image "logo-white.jpg"
end
# Replacing image
@@ -85,8 +82,7 @@ feature "Managing enterprise images" do
go_to_images
within ".page-admin-enterprises-form__promo-image-field-group" do
expect(page).to have_selector(".image-field-group__preview-image")
expect(html).to include("logo-black.jpg")
expect_preview_image "logo-black.jpg"
end
# Removing image
@@ -98,9 +94,17 @@ feature "Managing enterprise images" do
expect(page).to have_content("Promo image removed successfully")
within ".page-admin-enterprises-form__promo-image-field-group" do
expect(page).to have_no_selector(".image-field-group__preview-image")
expect_no_preview_image
end
end
end
end
def expect_preview_image(file_name)
expect(page).to have_selector(".image-field-group__preview-image[src*='#{file_name}']")
end
def expect_no_preview_image
expect(page).to have_no_selector(".image-field-group__preview-image")
end
end

View File

@@ -46,7 +46,7 @@ feature "Product Import", js: true do
attach_file 'file', '/tmp/test.csv'
click_button 'Upload'
import_data
proceed_to_validation
expect(page).to have_selector '.item-count', text: "2"
expect(page).to have_no_selector '.invalid-count'
@@ -89,7 +89,7 @@ feature "Product Import", js: true do
attach_file 'file', '/tmp/test.csv'
click_button 'Upload'
import_data
proceed_to_validation
expect(page).to have_selector '.item-count', text: "2"
expect(page).to have_selector '.invalid-count', text: "2"
@@ -112,7 +112,7 @@ feature "Product Import", js: true do
attach_file 'file', '/tmp/test.csv'
click_button 'Upload'
import_data
proceed_to_validation
expect(page).to have_selector '.item-count', text: "1"
expect(page).to have_selector '.create-count', text: "1"
@@ -142,7 +142,7 @@ feature "Product Import", js: true do
attach_file 'file', '/tmp/test.csv'
click_button 'Upload'
import_data
proceed_to_validation
save_data
@@ -164,7 +164,7 @@ feature "Product Import", js: true do
end
expect(page).to have_selector 'div#s2id_import_date_filter'
import_time = carrots.import_date.to_date.to_formatted_s(:long).gsub(' ', ' ')
import_time = carrots.import_date.to_date.to_formatted_s(:long)
select2_select import_time, from: "import_date_filter"
expect(page).to have_field "product_name", with: carrots.name
@@ -188,7 +188,7 @@ feature "Product Import", js: true do
click_button 'Upload'
import_data
proceed_to_validation
save_data
@@ -213,7 +213,7 @@ feature "Product Import", js: true do
attach_file 'file', '/tmp/test.csv'
click_button 'Upload'
import_data
proceed_to_validation
expect(page).to have_selector '.item-count', text: "3"
expect(page).to_not have_selector '.invalid-count'
@@ -252,7 +252,7 @@ feature "Product Import", js: true do
attach_file 'file', '/tmp/test.csv'
click_button 'Upload'
import_data
proceed_to_validation
expect(page).to have_selector '.item-count', text: "3"
expect(page).to have_no_selector '.invalid-count'
@@ -349,7 +349,7 @@ feature "Product Import", js: true do
attach_file 'file', '/tmp/test.csv'
click_button 'Upload'
import_data
proceed_to_validation
expect(page).to have_content I18n.t('admin.product_import.import.validation_overview')
expect(page).to have_selector '.item-count', text: "2"
@@ -361,9 +361,61 @@ feature "Product Import", js: true do
end
end
describe "handling a large file (120 data rows)" do
let!(:producer) { enterprise }
let(:tmp_csv_path) { "/tmp/test.csv" }
before do
quick_login_as admin
visit main_app.admin_product_import_path
end
context "when importing to product list" do
def write_tmp_csv_file
CSV.open(tmp_csv_path, "w") do |csv|
csv << ["name", "producer", "category", "on_hand", "price", "units", "unit_type",
"tax_category", "shipping_category"]
120.times do |i|
csv << ["Imported Product #{i + 1}", producer.name, category.name, 1, "1.00", "500",
"g", tax_category.name, shipping_category.name]
end
end
end
before { write_tmp_csv_file }
it "validates and saves all batches" do
# Upload and validate file.
attach_file "file", tmp_csv_path
click_button I18n.t("admin.product_import.index.upload")
proceed_to_validation
# Check that all rows are validated.
heading = "120 #{I18n.t("admin.product_import.import.products_to_create")}"
find(".panel-header", text: heading).click
expect(page).to have_content "Imported Product 10"
expect(page).to have_content "Imported Product 60"
expect(page).to have_content "Imported Product 110"
# Save file.
proceed_with_save
# Be extra patient.
expect_progress_percentages "33%", "67%", "100%"
expect_import_completed
# Check that all rows are saved.
expect(producer.supplied_products.find_by_name("Imported Product 10")).to be_present
expect(producer.supplied_products.find_by_name("Imported Product 60")).to be_present
expect(producer.supplied_products.find_by_name("Imported Product 110")).to be_present
end
end
end
private
def import_data
def proceed_to_validation
expect(page).to have_selector 'a.button.proceed', visible: true
click_link I18n.t('admin.product_import.import.import')
expect(page).to have_selector 'form.product-import', visible: true
@@ -372,8 +424,22 @@ feature "Product Import", js: true do
def save_data
expect(page).to have_selector 'a.button.proceed', visible: true
click_link I18n.t('admin.product_import.import.save')
proceed_with_save
expect(page).to have_selector 'div.save-results', visible: true
expect_import_completed
end
def expect_progress_percentages(*percentages)
percentages.each do |percentage|
expect(page).to have_selector ".progress-interface", text: percentage
end
end
def proceed_with_save
click_link I18n.t("admin.product_import.import.save")
end
def expect_import_completed
expect(page).to have_content I18n.t('admin.product_import.save_results.final_results')
end
end