diff --git a/z/calendar.go b/z/calendar.go index 1b7e2ad..0c8c0be 100644 --- a/z/calendar.go +++ b/z/calendar.go @@ -44,7 +44,7 @@ func NewCalendar(entries []Entry) (Calendar, error) { sameDayHours := decimal.NewFromInt(0) nextDayHours := decimal.NewFromInt(0) - projectId := GetProjectIdFromName(entry.Project) + projectId := GetIdFromName(entry.Project) if projects[projectId].Name == "" { project, err := database.GetProject(entry.User, entry.Project) diff --git a/z/database.go b/z/database.go index 89c4d0f..27d8910 100644 --- a/z/database.go +++ b/z/database.go @@ -229,7 +229,7 @@ func (database *Database) UpdateProject(user string, projectName string, project return jsonerr } - projectId := GetProjectIdFromName(projectName) + projectId := GetIdFromName(projectName) dberr := database.DB.Update(func(tx *buntdb.Tx) error { _, _, sperr := tx.Set(user + ":project:" + projectId, string(projectJson), nil) @@ -245,7 +245,7 @@ func (database *Database) UpdateProject(user string, projectName string, project func (database *Database) GetProject(user string, projectName string) (Project, error) { var project Project - projectId := GetProjectIdFromName(projectName) + projectId := GetIdFromName(projectName) dberr := database.DB.View(func(tx *buntdb.Tx) error { value, err := tx.Get(user + ":project:" + projectId, false) diff --git a/z/helpers.go b/z/helpers.go index b235bc9..493c31f 100644 --- a/z/helpers.go +++ b/z/helpers.go @@ -102,7 +102,7 @@ func ParseTime(timeStr string) (time.Time, error) { } } -func GetProjectIdFromName(projectName string) string { +func GetIdFromName(projectName string) string { reg, regerr := regexp.Compile("[^a-zA-Z0-9]+") if regerr != nil { return ""