1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-26 20:54:21 +01:00

Merge branch 'fix/birthdate-bug' into 'dev'

refacto project service, do the same but it is clear that service is receiving...

See merge request projets/fab-manager!19
This commit is contained in:
Peng 2023-11-24 14:18:17 +00:00
commit 10d58f08ad
8 changed files with 16 additions and 16 deletions

View File

@ -8,7 +8,8 @@
## v6.3.4 2023 November 23 ## v6.3.4 2023 November 23
- fix a bug: wrong amount when pay a reservation with payment schedule - fix a bug: wrong amount when pay a reservation with payment schedule
- fix regresion on PaymentScheduleItemWorker from v6.3.2 - fix a bug: regresion on PaymentScheduleItemWorker from v6.3.2
- fix a bug: event.pre_registration_end_date (was set to beginning_of_day instead of end_of_day)
## v6.3.3 2023 November 14 ## v6.3.3 2023 November 14

View File

@ -67,11 +67,10 @@ export const FormInput = <TFieldValues extends FieldValues, TInputType>({ id, re
return num; return num;
} }
if (type === 'date') { if (type === 'date') {
const date: Date = new Date(value + 'T00:00:00'); if (Number.isNaN(value) && nullable) {
if (Number.isNaN(date) && nullable) {
return null; return null;
} }
return date; return value;
} }
setCharacterCount(value?.length || 0); setCharacterCount(value?.length || 0);
return value; return value;

View File

@ -824,11 +824,12 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
* @param [concat] {boolean} if true, the result will be append to $scope.invoices instead of being affected * @param [concat] {boolean} if true, the result will be append to $scope.invoices instead of being affected
*/ */
const invoiceSearch = function (concat) { const invoiceSearch = function (concat) {
const date = $scope.searchInvoice.date ? $scope.searchInvoice.date.toISOString().slice(0, 10) : null;
Invoice.list({ Invoice.list({
query: { query: {
number: $scope.searchInvoice.reference, number: $scope.searchInvoice.reference,
customer: $scope.searchInvoice.name, customer: $scope.searchInvoice.name,
date: $scope.searchInvoice.date, date,
order_by: $scope.orderInvoice, order_by: $scope.orderInvoice,
page: $scope.page, page: $scope.page,
size: INVOICES_PER_PAGE size: INVOICES_PER_PAGE

View File

@ -28,6 +28,7 @@ class EventService
price_cat[:amount] = to_centimes(price_cat[:amount]) price_cat[:amount] = to_centimes(price_cat[:amount])
end end
end end
params[:pre_registration_end_date] = Date.parse(params[:pre_registration_end_date]).end_of_day if params[:pre_registration_end_date]
# return the resulting params object # return the resulting params object
params params
end end

View File

@ -29,10 +29,9 @@ class InvoicesService
) )
end end
unless filters[:date].nil? unless filters[:date].nil?
invoices = invoices.where( start_at = Date.parse(filters[:date]).in_time_zone
"date_trunc('day', invoices.created_at) = :search", end_at = start_at.end_of_day
search: "%#{Time.iso8601(filters[:date]).in_time_zone.to_date}%" invoices = invoices.where(created_at: (start_at..end_at))
)
end end
invoices invoices

View File

@ -127,7 +127,7 @@ class Orders::OrderService
def filter_by_period(orders, filters) def filter_by_period(orders, filters)
return orders unless filters[:period_from].present? && filters[:period_to].present? return orders unless filters[:period_from].present? && filters[:period_to].present?
orders.where(created_at: Time.zone.parse(filters[:period_from])..Time.zone.parse(filters[:period_to]).end_of_day) orders.where(created_at: Date.parse(filters[:period_from]).in_time_zone..Date.parse(filters[:period_to]).in_time_zone.end_of_day)
end end
def orders_ordering(orders, filters) def orders_ordering(orders, filters)

View File

@ -146,10 +146,9 @@ class PaymentScheduleService
) )
end end
unless filters[:date].nil? unless filters[:date].nil?
ps = ps.where( start_at = Date.parse(filters[:date]).in_time_zone
"date_trunc('day', payment_schedules.created_at) = :search OR date_trunc('day', payment_schedule_items.due_date) = :search", end_at = start_at.end_of_day
search: "%#{Time.zone.iso8601(filters[:date]).to_date}%" ps = ps.where("(payment_schedules.created_at BETWEEN :start_at AND :end_at) OR (payment_schedule_items.due_date BETWEEN :start_at AND :end_at)", start_at: start_at, end_at: end_at).references(:payment_schedule_items)
)
end end
ps ps

View File

@ -32,8 +32,8 @@ class ProjectService
end end
end end
created_from = Time.zone.parse(query_params['from_date']).beginning_of_day if query_params['from_date'].present? created_from = Date.parse(query_params['from_date']).in_time_zone.beginning_of_day if query_params['from_date'].present?
created_to = Time.zone.parse(query_params['to_date']).end_of_day if query_params['to_date'].present? created_to = Date.parse(query_params['to_date']).in_time_zone.end_of_day if query_params['to_date'].present?
if created_from || created_to if created_from || created_to
records = records.where(created_at: created_from..created_to) records = records.where(created_at: created_from..created_to)
end end