wip stats

This commit is contained in:
Dobromir Popov
2024-05-04 14:30:20 +03:00
parent 17b8adbab8
commit c7980f46bb
3 changed files with 7 additions and 5 deletions

View File

@ -67,6 +67,7 @@ function ContactsPage({ allPublishers }) {
});
}
setFilteredPublishers(filtered);
setPubWithAssignmentsCount(filtered.filter(publisher => publisher.currentMonthAvailabilityHoursCount && publisher.currentMonthAvailabilityHoursCount > 0).length);
}, [searchQuery, publisherType, sortField, sortOrder, allPublishers]);
useEffect(() => {
@ -75,7 +76,7 @@ function ContactsPage({ allPublishers }) {
const month = parseInt(selectedMonth);
const filterDate = new Date(new Date().getFullYear(), month - 1, 15);
try {
const response = await axiosInstance.get(`/api/?action=getAllPublishersWithStatistics&date=${filterDate.toISOString()}`);
const response = await axiosInstance.get(`/api/?action=getAllPublishersWithStatistics&date=${filterDate.toISOString()}&noEndDate=false`);
setPublishers(response.data);
setFilteredPublishers(response.data);
@ -101,7 +102,7 @@ function ContactsPage({ allPublishers }) {
<ProtectedRoute allowedRoles={[UserRole.ADMIN, UserRole.POWERUSER, UserRole.USER]}>
<div className="container mx-auto p-4">
<h1 className="text-xl font-semibold mb-4">Статистика </h1>
<h5 className="text-lg font-semibold mb-4">{pubWithAssignmentsCount} участника с предпочитания за месеца (от {allPublishers.length} )</h5>
<h5 className="text-lg font-semibold mb-4">{pubWithAssignmentsCount} участника с предпочитания за месеца (от {filteredPublishers.length} )</h5>
<div className="mb-4 flex justify-between items-center">
<input
type="text"