Rename, fix and testing for getAllWeeklyReports path

This commit is contained in:
Imbus 2024-04-03 17:31:39 +02:00
parent a1d2520d88
commit a39cfedad3
4 changed files with 36 additions and 17 deletions

View file

@ -35,7 +35,7 @@ type Database interface {
GetProject(projectId int) (types.Project, error)
GetUserRole(username string, projectname string) (string, error)
GetWeeklyReport(username string, projectName string, week int) (types.WeeklyReport, error)
GetWeeklyReportsUser(username string, projectname string) ([]types.WeeklyReportList, error)
GetAllWeeklyReports(username string, projectname string) ([]types.WeeklyReportList, error)
GetUnsignedWeeklyReports(projectName string) ([]types.WeeklyReport, error)
SignWeeklyReport(reportId int, projectManagerId int) error
IsSiteAdmin(username string) (bool, error)
@ -463,8 +463,8 @@ func (d *Db) Migrate() error {
return nil
}
// GetWeeklyReportsUser retrieves weekly reports for a specific user and project.
func (d *Db) GetWeeklyReportsUser(username string, projectName string) ([]types.WeeklyReportList, error) {
// GetAllWeeklyReports retrieves weekly reports for a specific user and project.
func (d *Db) GetAllWeeklyReports(username string, projectName string) ([]types.WeeklyReportList, error) {
query := `
SELECT
wr.week,

View file

@ -705,7 +705,7 @@ func TestGetWeeklyReportsUser(t *testing.T) {
t.Error("AddWeeklyReport failed:", err)
}
reports, err := db.GetWeeklyReportsUser("testuser", "testproject")
reports, err := db.GetAllWeeklyReports("testuser", "testproject")
if err != nil {
t.Error("GetWeeklyReportsUser failed:", err)
}
@ -962,6 +962,5 @@ func TestRemoveProject(t *testing.T) {
if len(projects) != 0 {
t.Error("RemoveProject failed: expected 0, got", len(projects))
}
}