devaslanphp / project-management

An open source Project management tool based on Laravel and Filament
https://devaslanphp.github.io/project-management
MIT License
721 stars 200 forks source link

Feature/timesheet dashboard #53

Closed mihaisolomon closed 1 year ago

mihaisolomon commented 1 year ago

@heloufir Take a look over this. That error should be gone.

mihaisolomon commented 1 year ago

Added a table instead of a view for the time logged

image

heloufir commented 1 year ago

Added a table instead of a view for the time logged

image

That looks better, but I think the Ticket column is not needed, because this table will be visible inside a Ticket view, so all the rows are linked to the shown ticket.

heloufir commented 1 year ago

@mihaisolomon yep the first error is resolved, but I got another like I have said in the issue #29

image

https://flareapp.io/share/Bm0BJyW7

I think the activity is null, and it need to be checked with a condition like below:

foreach ($collection as $item) {
    if ($item->activity) { // <- HERE
        $datasets['sets'][] = $item->value;
        $datasets['labels'][] = $item->activity->name;
    } // <- HERE
}

Or better, because I logged my time without linking it to any activity,

foreach ($collection as $item) {
    $datasets['sets'][] = $item->value;
    $datasets['labels'][] = $item->activity?->name ?? __('No activity');
}

Here is the dd of my collection: image