mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-12-01 12:24:28 +01:00
optimize payment schedules list loading
This commit is contained in:
parent
94c4be3e61
commit
61f432914c
@ -1,4 +1,4 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import React, { useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { react2angular } from 'react2angular';
|
||||
import { DocumentFilters } from '../document-filters';
|
||||
@ -38,13 +38,6 @@ const PaymentSchedulesList: React.FC<PaymentSchedulesListProps> = ({ currentUser
|
||||
// current filter, by date, for the schedules and the deadlines
|
||||
const [dateFilter, setDateFilter] = useState<Date>(null);
|
||||
|
||||
/**
|
||||
* When the component is loaded first, refresh the list of schedules to fill the first page.
|
||||
*/
|
||||
useEffect(() => {
|
||||
handleRefreshList();
|
||||
}, []);
|
||||
|
||||
/**
|
||||
* Fetch from the API the payments schedules matching the given filters and reset the results table with the new schedules.
|
||||
*/
|
||||
|
@ -127,7 +127,7 @@ class PaymentScheduleService
|
||||
# @param filters {Hash} allowed filters: reference, customer, date.
|
||||
##
|
||||
def self.list(page, size, filters = {})
|
||||
ps = PaymentSchedule.includes(:invoicing_profile, :payment_schedule_items)
|
||||
ps = PaymentSchedule.includes(:invoicing_profile, :payment_schedule_items, :payment_schedule_objects)
|
||||
.joins(:invoicing_profile)
|
||||
.order('payment_schedules.created_at DESC')
|
||||
.page(page)
|
||||
|
Loading…
Reference in New Issue
Block a user