GetProjectIdFromName -> GetIdFromName
This commit is contained in:
parent
798af1a486
commit
ee1ab3204b
3 changed files with 4 additions and 4 deletions
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 ""
|
||||
|
|
Loading…
Reference in a new issue