Skip to content

Commit

Permalink
apache#79 modify
Browse files Browse the repository at this point in the history
  • Loading branch information
GuoYL123 committed Feb 29, 2020
1 parent 081befd commit d6e1eb6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion server/resource/v1/history_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func TestHistoryResource_GetPollingData(t *testing.T) {
assert.Equal(t, kv.Labels, data.Labels)
})
t.Run("get polling data", func(t *testing.T) {
r, _ := http.NewRequest("GET", "/v1/test/kie/polling_data?instanceId=test&domain=default", nil)
r, _ := http.NewRequest("GET", "/v1/test/kie/polling_data?sessionId=test", nil)
noopH := &handler2.NoopAuthHandler{}
chain, _ := handler.CreateChain(common.Provider, "testchain1", noopH.Name())
r.Header.Set("Content-Type", "application/json")
Expand Down
19 changes: 12 additions & 7 deletions server/service/mongo/record/polling_detail_dao.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,18 @@ func CreateOrUpdate(ctx context.Context, detail *model.PollingDetail) (*model.Po
//Get is to get a
func Get(ctx context.Context, detail *model.PollingDetail) ([]*model.PollingDetail, error) {
collection := session.GetDB().Collection(session.CollectionPollingDetail)
queryFilter := bson.M{
"domain": detail.Domain,
"session_id": detail.SessionID,
"id": detail.ID,
"ip": detail.IP,
"user_agent": detail.UserAgent,
"url_path": detail.URLPath,
queryFilter := bson.M{"domain": detail.Domain}
if detail.SessionID != "" {
queryFilter["session_id"] = detail.SessionID
}
if detail.IP != "" {
queryFilter["ip"] = detail.IP
}
if detail.UserAgent != "" {
queryFilter["user_agent"] = detail.UserAgent
}
if detail.URLPath != "" {
queryFilter["url_path"] = detail.URLPath
}
cur, err := collection.Find(ctx, queryFilter)
if err != nil {
Expand Down

0 comments on commit d6e1eb6

Please sign in to comment.