mirror of
https://github.com/orangecoding/fredy.git
synced 2026-06-16 12:31:07 +00:00
change average price to median price on the dashboard (#300)
* change average price to median price on the dashboard * Use more efficient median calculation Co-authored-by: Christian Kellner <weakmap@gmail.com> * Fix applied suggestion artifacts * Update sql query and js sort function * Group sql statement by id * Revert sort function change --------- Co-authored-by: Christian Kellner <weakmap@gmail.com>
This commit is contained in:
@@ -37,7 +37,7 @@ dashboardRouter.get('/', async (req, res) => {
|
||||
const totalJobs = jobs.length;
|
||||
const totalListings = jobs.reduce((sum, j) => sum + (j.numberOfFoundListings || 0), 0);
|
||||
const jobIds = jobs.map((j) => j.id);
|
||||
const { numberOfActiveListings, avgPriceOfListings } = getListingsKpisForJobIds(jobIds);
|
||||
const { numberOfActiveListings, medianPriceOfListings } = getListingsKpisForJobIds(jobIds);
|
||||
// Build Pie data in a simple shape the frontend can consume directly
|
||||
// Shape: { labels: string[], values: number[] } with values as percentages
|
||||
const providerPieRaw = getProviderDistributionForJobIds(jobIds);
|
||||
@@ -63,7 +63,7 @@ dashboardRouter.get('/', async (req, res) => {
|
||||
totalJobs,
|
||||
totalListings,
|
||||
numberOfActiveListings,
|
||||
avgPriceOfListings,
|
||||
medianPriceOfListings,
|
||||
},
|
||||
pie: providerPie,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user