mtierltd / timetracker

GNU Affero General Public License v3.0
82 stars 27 forks source link

Goals page throws an error #138

Closed johnmadrak closed 2 years ago

johnmadrak commented 2 years ago

I attempted to create a goal in the Time Keeper app and I received an error.

I now receive an error anytime I access the Goals page.

The following exception is in the logs:

    "Exception": "Doctrine\\DBAL\\Exception\\NonUniqueFieldNameException",
    "Message": "An exception occurred while executing a query: SQLSTATE[42702]: Ambiguous column: 7 ERROR:  GROUP BY \"ftime\" is ambiguous\nLINE 3: ....project_id in ($3)) and (user_uid = $4) group by ftime,\"pro...\n                                                             ^",

And this seems to be the relevant part of the trace:

        "file": "/var/www/html/custom_apps/timetracker/lib/Db/ReportItemMapper.php",
        "line": 251,
        "function": "findEntities",
        "class": "OCP\\AppFramework\\Db\\Mapper",
        "type": "->",
        "args": [
          "SELECT min(wi.id) as id, sum(duration) as \"totalDuration\", '*' as \"details\", start as time, start as ftime, concat(date_part('year', to_timestamp(start)), 'W', to_char(to_timestamp(start), 'IW')) as ftime, '*' as name, '*' as \"projectId\", p.name as project, '*' as \"clientId\", string_agg(distinct c.name, ',') as client, string_agg(distinct user_uid, ',') as \"userUid\" FROM *PREFIX*timetracker_work_interval wi \n                    left join *PREFIX*timetracker_project p on wi.project_id = p.id \n                    left join *PREFIX*timetracker_client c on p.client_id = c.id where (start > ?) and (start < ?) and (wi.project_id in (?)) and (user_uid = ?) group by ftime,\"project\" order by start desc",

Please let me know if you need any additional information.