This is an automated email from the ASF dual-hosted git repository.
zhangliang2022 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/main by this push:
new 6d01c6399 fix: sonarqube lastAnalysisDate string to iso8601Time (#5685)
6d01c6399 is described below
commit 6d01c6399cfed811f3ee0174c502a7dfb23fe459
Author: abeizn <[email protected]>
AuthorDate: Tue Jul 18 21:36:48 2023 +0800
fix: sonarqube lastAnalysisDate string to iso8601Time (#5685)
---
backend/plugins/sonarqube/api/scope.go | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/backend/plugins/sonarqube/api/scope.go
b/backend/plugins/sonarqube/api/scope.go
index 4b0e11f74..1b3a48b31 100644
--- a/backend/plugins/sonarqube/api/scope.go
+++ b/backend/plugins/sonarqube/api/scope.go
@@ -42,6 +42,22 @@ type ScopeReq api.ScopeReq[models.SonarqubeProject]
// @Failure 500 {object} shared.ApiBody "Internal Error"
// @Router /plugins/sonarqube/connections/{connectionId}/scopes [PUT]
func PutScope(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput,
errors.Error) {
+ // decode request body to scope, deal with lastAnalysisDate format
+ data := input.Body["data"].([]interface{})
+ for _, item := range data {
+ dateStr, ok :=
item.(map[string]interface{})["lastAnalysisDate"].(string)
+ if !ok {
+ continue
+ }
+ timeObj, err := api.ConvertStringToTime(dateStr)
+ if err != nil {
+ panic(err)
+ }
+
+ item.(map[string]interface{})["lastAnalysisDate"] = timeObj
+
+ }
+
return scopeHelper.Put(input)
}