You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by gi...@apache.org on 2024/07/04 10:07:39 UTC

(incubator-devlake) branch release-v1.0-auto-cherry-pick-7695 created (now 22205cd1a)

This is an automated email from the ASF dual-hosted git repository.

github-bot pushed a change to branch release-v1.0-auto-cherry-pick-7695
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


      at 22205cd1a fix(framework): case-insensitive when getting projects with keyword (#7695)

This branch includes the following new commits:

     new 22205cd1a fix(framework): case-insensitive when getting projects with keyword (#7695)

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(incubator-devlake) 01/01: fix(framework): case-insensitive when getting projects with keyword (#7695)

Posted by gi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

github-bot pushed a commit to branch release-v1.0-auto-cherry-pick-7695
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git

commit 22205cd1afba0ff3237c1be770449e582f188fdd
Author: Lynwee <li...@merico.dev>
AuthorDate: Thu Jul 4 18:07:19 2024 +0800

    fix(framework): case-insensitive when getting projects with keyword (#7695)
---
 backend/server/services/project.go | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/backend/server/services/project.go b/backend/server/services/project.go
index 8e87d1c81..58ed4b173 100644
--- a/backend/server/services/project.go
+++ b/backend/server/services/project.go
@@ -20,6 +20,7 @@ package services
 import (
 	"fmt"
 	"golang.org/x/sync/errgroup"
+	"strings"
 	"time"
 
 	"github.com/apache/incubator-devlake/core/dal"
@@ -37,7 +38,7 @@ type ProjectQuery struct {
 
 func (query *ProjectQuery) GetKeyword() string {
 	if query != nil && query.Keyword != nil {
-		return *query.Keyword
+		return strings.ToLower(*query.Keyword)
 	}
 	return ""
 }
@@ -52,7 +53,7 @@ func GetProjects(query *ProjectQuery) ([]*models.ApiOutputProject, int64, errors
 		dal.From(&models.Project{}),
 	}
 	if query.Keyword != nil {
-		clauses = append(clauses, dal.Where("name LIKE ?", "%"+query.GetKeyword()+"%"))
+		clauses = append(clauses, dal.Where("LOWER(name) LIKE ?", "%"+query.GetKeyword()+"%"))
 	}
 
 	count, err := db.Count(clauses...)