Closed SuspenseFallback closed 1 year ago
Please, assign this issue to me!
@nivekgtc @nmcharlton Not sure if this is helpful, but I took a quick look at this and realized the earnings API itself was returning 'undefined undefined' as grower. I then dug into the earnings api in the models/earnings.js file and noticed it was pulling from data returned via the stakeholders api in line 101 where it shows: "grower: ${growerResponse?.first_name} ${growerResponse?.last_name}
," and that pulls data from line 89: const growerResponse = await getStakeholderById(worker_id);
Could it be that the stakeholder info does not have a first or last name?
I also saw that in this commit: https://github.com/Greenstand/treetracker-earnings-api/commit/58e97130f79c8b20a8c45f69250ee10fb5f74ead
The earnings model called: growerResponse.data.stakeholders[0]?.last_name
Does the earnings model just need to adjust how it accesses that first and last name?
I could not test without installing postgre etc and since this is already assigned, I am going to move on to one of the good first issues, but I thought I would share what I found in case it was helpful.
This is a screenshot of the Earnings API response used in the EarningsTable.js - note the grower field.
This is a screenshot of the location for grower in models/Earnings.js in the earnings api.
See image.