Skip to content

Commit be7e826

Browse files
committed
wip
1 parent a5938b3 commit be7e826

3 files changed

Lines changed: 52 additions & 5 deletions

File tree

changelog_internal.md

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ Removed redundant status column from members table to maintain consistency with
246246
247247
### Remove Pie Chart from Reporting Pages
248248
249-
Removed the same pie chart component from reporting pages as was removed from dashboard.
249+
Completely removed the ReportingPieChart component from the entire application.
250250
251251
**Files modified:**
252252
- `resources/js/Components/Common/Reporting/ReportingOverview.vue`
@@ -267,12 +267,56 @@ Removed the same pie chart component from reporting pages as was removed from da
267267
- </div>
268268
```
269269
270+
**Removed computed properties:**
271+
```js
272+
- const groupedPieChartData = computed(() => { ... });
273+
```
274+
275+
**File to delete:** `resources/js/Components/Common/Reporting/ReportingPieChart.vue` (component file no longer needed)
276+
270277
**Layout changes:**
271278
- Removed sidebar layout (grid-cols-4)
272279
- Table now spans full width
273280
- Bar chart (ReportingChart) remains for data visualization
274281
275-
**Result:** Reporting pages now show only the bar chart and data table, with the pie chart sidebar removed.
282+
**Result:** ReportingPieChart component completely removed from the application - no imports, no usage, no data generation.
283+
284+
### Performance Optimization: Projects Search Filter
285+
286+
Optimized the search filter in Projects.vue to improve performance when searching through projects and their associated clients.
287+
288+
**File modified:** `resources/js/Pages/Projects.vue`
289+
290+
**Problem:** O(n*m) complexity - the client lookup inside the filter loop was inefficient
291+
- For each project (n), was calling `clients.value.find()` (m operations)
292+
- With many projects and clients, this created performance bottlenecks
293+
294+
**Solution:** Create clientsMap before filtering for O(1) lookup
295+
296+
**Before:**
297+
```js
298+
// Search in client name
299+
const client = clients.value.find(client => client.id === project.client_id);
300+
const clientNameMatch = client?.name.toLowerCase().includes(query) || false;
301+
```
302+
303+
**After:**
304+
```js
305+
// Create clients map for O(1) lookup performance
306+
const clientsMap = new Map(clients.value.map(c => [c.id, c]));
307+
308+
filteredProjects = filteredProjects.filter((project) => {
309+
// Search in client name
310+
const client = clientsMap.get(project.client_id);
311+
const clientNameMatch = client?.name.toLowerCase().includes(query) || false;
312+
// ...
313+
});
314+
```
315+
316+
**Performance improvement:** O(n*m) → O(n+m) complexity
317+
- Map creation: O(m) - done once
318+
- Lookups: O(1) per project instead of O(m)
319+
- Significant improvement with large datasets
276320
277321
### Fix Client Table Column Positioning
278322

resources/js/Components/Common/Client/ClientTableRow.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ const showEditModal = ref(false);
4040
<ClientEditModal
4141
v-model:show="showEditModal"
4242
:client="client"></ClientEditModal>
43-
<div
44-
class="whitespace-nowrap py-4 pr-3 text-sm font-medium text-text-primary pl-4 sm:pl-6 lg:pl-8 3xl:pl-12">
43+
<div class="whitespace-nowrap py-4 pr-3 text-sm font-medium text-text-primary pl-4 sm:pl-6 lg:pl-8">
4544
<span>
4645
{{ client.name }}
4746
</span>

resources/js/Pages/Projects.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,16 @@ const shownProjects = computed(() => {
5050
// Apply search filter
5151
if (searchQuery.value.trim()) {
5252
const query = searchQuery.value.toLowerCase().trim();
53+
54+
// Create clients map for O(1) lookup performance
55+
const clientsMap = new Map(clients.value.map(c => [c.id, c]));
56+
5357
filteredProjects = filteredProjects.filter((project) => {
5458
// Search in project name
5559
const projectNameMatch = project.name.toLowerCase().includes(query);
5660
5761
// Search in client name
58-
const client = clients.value.find(client => client.id === project.client_id);
62+
const client = clientsMap.get(project.client_id);
5963
const clientNameMatch = client?.name.toLowerCase().includes(query) || false;
6064
6165
return projectNameMatch || clientNameMatch;

0 commit comments

Comments
 (0)