From 791ca84414dbe185837a93169487e8b7aa2ca338 Mon Sep 17 00:00:00 2001 From: dtookey Date: Thu, 19 May 2022 09:56:43 -0400 Subject: [PATCH] Removed debugging lines from GetTimeAllTimeEntriesForUserThroughDate, but kept the non-200 response code debugging line. Modified insight-connect.go to only capture time entry data from engineering users. Added line for updating some finance info into the main mercury.go routine, but it's commented out until the delivery pipeline gets sorted out. --- run.sh | 2 +- src/mercury.go | 1 + src/projectInsight/insight-connect.go | 6 +++++- src/projectInsight/insight-database.go | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/run.sh b/run.sh index 09f881f..b12bcd7 100644 --- a/run.sh +++ b/run.sh @@ -4,7 +4,7 @@ cd /opt/go/src/mercury || exit rm build/* -go build -o ./build/mercury ./src +go build -o ./build/mercury ./src/mercury.go mercury_qb_path="/home/dtookey/work/clarity-reporting/qb/" DB_CREDS="$(cat /home/dtookey/work/datastudio-db-creds.txt)" DB_HOST=data-connect.carolina.engineering ./build/mercury diff --git a/src/mercury.go b/src/mercury.go index 9b86a82..a65b8c9 100644 --- a/src/mercury.go +++ b/src/mercury.go @@ -35,6 +35,7 @@ func updateInsightData() { icx.Init() icx.UpdateUsers() icx.UpdateTimeEntries() + //finance.GenerateArAgingReport("/home/dtookey/work/clarity-reporting/qb/ar/") } func processQbBilling() { diff --git a/src/projectInsight/insight-connect.go b/src/projectInsight/insight-connect.go index 29bce79..a68842a 100644 --- a/src/projectInsight/insight-connect.go +++ b/src/projectInsight/insight-connect.go @@ -112,6 +112,7 @@ func (iClient *InsightClient) GetTimeAllTimeEntriesForUserThroughDate(userId str container := make([]*InsightTimeEntry, 0, 1000) //do we want to make the default result size parametric? err := json.Unmarshal(*rawBytes, &container) if err != nil { + log.Printf("Error with following string: %s\n", string(*rawBytes)) log.Panic(err) } returnChan <- &container @@ -146,7 +147,6 @@ func (iClient *InsightClient) getRawUsers() *[]*InsightUser { req := iClient.createRequest(userEndpoint, insightTokenFile) rawBytes := iClient.doGet(req) container := make([]*InsightUser, 0, 150) //do we want to make the default result size parametric? - log.Println(string(*rawBytes)) err := json.Unmarshal(*rawBytes, &container) if err != nil { log.Panic(err) @@ -161,6 +161,10 @@ func (iClient *InsightClient) doGet(req *http.Request) *[]byte { log.Panic(err) } + if resp.StatusCode != 200 { + log.Printf("Got non-200 response from request: %s\t%d", req.URL, resp.StatusCode) + } + bodyBytes, err := ioutil.ReadAll(resp.Body) if err != nil { log.Panic(err) diff --git a/src/projectInsight/insight-database.go b/src/projectInsight/insight-database.go index 670380e..0bfbbd2 100644 --- a/src/projectInsight/insight-database.go +++ b/src/projectInsight/insight-database.go @@ -78,7 +78,7 @@ func (c *InsightDBConnector) ReadUsers() *[]*InsightUser { return db.QueryForObjects[InsightUser]( c.ConnectorGeneric, db.InsightDatabaseName, - "read-insight-allUsers.sql", + "read-insight-engineerUsers.sql", insightUserMappingFunction, ) }