1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-03-01 23:29:23 +01:00

quick coding rules checking with rubocop

This commit is contained in:
Sylvain 2019-09-09 18:04:31 +02:00
parent e94cf46fa4
commit e9e27663cd
8 changed files with 34 additions and 42 deletions

View File

@ -350,11 +350,7 @@ Application.Directives.directive('cart', [ '$rootScope', '$uibModal', 'dialogs',
if ($scope.isAdmin()) { return true; } if ($scope.isAdmin()) { return true; }
const slotStart = moment(slot.start); const slotStart = moment(slot.start);
const now = moment(); const now = moment();
if (slot.can_modify && $scope.enableBookingMove && (slotStart.diff(now, 'hours') >= $scope.moveBookingDelay)) { return (slot.can_modify && $scope.enableBookingMove && (slotStart.diff(now, 'hours') >= $scope.moveBookingDelay));
return true;
} else {
return false;
}
}; };
/** /**
@ -365,11 +361,7 @@ Application.Directives.directive('cart', [ '$rootScope', '$uibModal', 'dialogs',
if ($scope.isAdmin()) { return true; } if ($scope.isAdmin()) { return true; }
const slotStart = moment(slot.start); const slotStart = moment(slot.start);
const now = moment(); const now = moment();
if (slot.can_modify && $scope.enableBookingCancel && (slotStart.diff(now, 'hours') >= $scope.cancelBookingDelay)) { return (slot.can_modify && $scope.enableBookingCancel && (slotStart.diff(now, 'hours') >= $scope.cancelBookingDelay));
return true;
} else {
return false;
}
}; };
/** /**
@ -448,7 +440,7 @@ Application.Directives.directive('cart', [ '$rootScope', '$uibModal', 'dialogs',
slots_attributes: [], slots_attributes: [],
plan_id: ((plan ? plan.id : undefined)) plan_id: ((plan ? plan.id : undefined))
}; };
angular.forEach(slots, function (slot, key) { angular.forEach(slots, function (slot) {
reservation.slots_attributes.push({ reservation.slots_attributes.push({
start_at: slot.start, start_at: slot.start,
end_at: slot.end, end_at: slot.end,
@ -608,7 +600,7 @@ Application.Directives.directive('cart', [ '$rootScope', '$uibModal', 'dialogs',
} }
, function (response) { , function (response) {
$scope.alerts = []; $scope.alerts = [];
$scope.alerts.push({ msg: _t('cart.a_problem_occured_during_the_payment_process_please_try_again_later'), type: 'danger' }); $scope.alerts.push({ msg: _t('cart.a_problem_occurred_during_the_payment_process_please_try_again_later'), type: 'danger' });
return $scope.attempting = false; return $scope.attempting = false;
}); });
}; };
@ -618,7 +610,7 @@ Application.Directives.directive('cart', [ '$rootScope', '$uibModal', 'dialogs',
}).result['finally'](null).then(function (reservation) { afterPayment(reservation); }); }).result['finally'](null).then(function (reservation) { afterPayment(reservation); });
}; };
/** /**
* Actions to run after the payment was successfull * Actions to run after the payment was successful
*/ */
var afterPayment = function (reservation) { var afterPayment = function (reservation) {
// we set the cart content as 'paid' to display a summary of the transaction // we set the cart content as 'paid' to display a summary of the transaction

View File

@ -5,7 +5,6 @@ class API::PaymentsController < API::ApiController
before_action :authenticate_user! before_action :authenticate_user!
def confirm_payment def confirm_payment
begin begin
if params[:payment_method_id].present? if params[:payment_method_id].present?
# Create the PaymentIntent # Create the PaymentIntent
@ -39,6 +38,7 @@ class API::PaymentsController < API::ApiController
render status: 200, json: { error: e.message } render status: 200, json: { error: e.message }
end end
# TODO extract in subroutine
if intent.status == 'succeeded' if intent.status == 'succeeded'
begin begin
user_id = params[:cart_items][:reservation][:user_id] user_id = params[:cart_items][:reservation][:user_id]
@ -75,7 +75,7 @@ class API::PaymentsController < API::ApiController
} }
} }
elsif intent.status == 'succeeded' elsif intent.status == 'succeeded'
# The payment didnt need any additional actions and is completed! # The payment didn't need any additional actions and is completed!
# Handle post-payment fulfillment # Handle post-payment fulfillment
{ status: 200, json: { success: true } } { status: 200, json: { success: true } }
else else

View File

@ -461,5 +461,5 @@ en:
reservation_was_cancelled_successfully: "Reservation was cancelled successfully." reservation_was_cancelled_successfully: "Reservation was cancelled successfully."
cancellation_failed: "Cancellation failed." cancellation_failed: "Cancellation failed."
confirm_payment_of_html: "{ROLE, select, admin{Payment on site} other{Pay}}: {AMOUNT}" # messageFormat interpolation (context: confirm my payment of $20.00) confirm_payment_of_html: "{ROLE, select, admin{Payment on site} other{Pay}}: {AMOUNT}" # messageFormat interpolation (context: confirm my payment of $20.00)
a_problem_occured_during_the_payment_process_please_try_again_later: "A problem occurred during the payment process. Please try again later." a_problem_occurred_during_the_payment_process_please_try_again_later: "A problem occurred during the payment process. Please try again later."
none: "None" none: "None"

View File

@ -461,5 +461,5 @@ es:
reservation_was_cancelled_successfully: "La reserva se ha cancelado con éxito." reservation_was_cancelled_successfully: "La reserva se ha cancelado con éxito."
cancellation_failed: "Cancelación fallida." cancellation_failed: "Cancelación fallida."
confirm_payment_of_html: "{ROLE, select, admin{Payment on site} other{Pay}}: {AMOUNT}" # messageFormat interpolation (context: confirm my payment of $20.00) confirm_payment_of_html: "{ROLE, select, admin{Payment on site} other{Pay}}: {AMOUNT}" # messageFormat interpolation (context: confirm my payment of $20.00)
a_problem_occured_during_the_payment_process_please_try_again_later: "A problem occurred during the payment process. Please try again later." a_problem_occurred_during_the_payment_process_please_try_again_later: "A problem occurred during the payment process. Please try again later."
none: "Ninguno" none: "Ninguno"

View File

@ -461,5 +461,5 @@ fr:
reservation_was_cancelled_successfully: "La réservation a bien été annulée." reservation_was_cancelled_successfully: "La réservation a bien été annulée."
cancellation_failed: "L'annulation a échouée." cancellation_failed: "L'annulation a échouée."
confirm_payment_of_html: "{ROLE, select, admin{Paiement sur place} other{Payer}} : {AMOUNT}" # messageFormat interpolation (contexte : valider mon paiement de 20,00 €) confirm_payment_of_html: "{ROLE, select, admin{Paiement sur place} other{Payer}} : {AMOUNT}" # messageFormat interpolation (contexte : valider mon paiement de 20,00 €)
a_problem_occured_during_the_payment_process_please_try_again_later: "Il y a eu un problème lors de la procédure de paiement. Veuillez réessayer plus tard." a_problem_occurred_during_the_payment_process_please_try_again_later: "Il y a eu un problème lors de la procédure de paiement. Veuillez réessayer plus tard."
none: "Aucune" none: "Aucune"

View File

@ -461,5 +461,5 @@ pt:
reservation_was_cancelled_successfully: "Reserva a foi cancelada com sucesso." reservation_was_cancelled_successfully: "Reserva a foi cancelada com sucesso."
cancellation_failed: "Cancelamento falhou." cancellation_failed: "Cancelamento falhou."
confirm_payment_of_html: "{ROLE, select, admin{Pagamento pelo site} other{Pagar}}: {AMOUNT}" # messageFormat interpolation (context: confirm my payment of $20.00) confirm_payment_of_html: "{ROLE, select, admin{Pagamento pelo site} other{Pagar}}: {AMOUNT}" # messageFormat interpolation (context: confirm my payment of $20.00)
a_problem_occured_during_the_payment_process_please_try_again_later: "Um problema ocorreu durante o processo de pagamento. Por favor tente novamente mais tarde." a_problem_occurred_during_the_payment_process_please_try_again_later: "Um problema ocorreu durante o processo de pagamento. Por favor tente novamente mais tarde."
none: "Vazio" none: "Vazio"