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, ) }