Ejemplo n.º 1
0
 public static function userTimeForProject($projectId)
 {
     try {
         $users;
         $userIdList = \Projectcollabs::where('project_id', $projectId)->lists('user_id');
         $taskIdList = \Task::where('project_id', $projectId)->lists('id');
         foreach ($userIdList as $userId) {
             $tempUserData;
             $timeList = \Timesheet::whereIn('task_id', $taskIdList)->where('user_id', $userId)->lists('total_time_spent');
             $totalTime = 0;
             foreach ($timeList as $time) {
                 $totalTime = $totalTime + $time;
             }
             $user = \User::find($userId);
             $tempUserData['userName'] = $user->first_name . $user->last_name;
             $tempUserData['userId'] = $userId;
             $tempUserData['totalTime'] = \DateAndTime::convertTime($totalTime);
             $users[] = $tempUserData;
         }
         return $users;
     } catch (\Exception $e) {
         \Log::error('Something Went Wrong in Report Repository - userTimeForProject():' . $e->getMessage());
         throw new SomeThingWentWrongException();
     }
 }