Fixing report signing database interface

This commit is contained in:
Imbus 2024-04-04 22:39:55 +02:00
parent abfb79b991
commit 68e6f94d13

View file

@ -350,9 +350,14 @@ func (d *Db) SignWeeklyReport(reportId int, projectManagerId int) error {
return err
}
managerQuery := `SELECT project_id FROM user_roles
WHERE user_id = ?
AND project_id = (SELECT project_id FROM weekly_reports WHERE report_id = ?)
AND p_role = 'project_manager'`
// Retrieve the project ID associated with the project manager
var managerProjectID int
err = d.Get(&managerProjectID, "SELECT project_id FROM user_roles WHERE user_id = ? AND p_role = 'project_manager'", projectManagerId)
err = d.Get(&managerProjectID, managerQuery, projectManagerId, reportId)
if err != nil {
return err
}