-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
some refactoring to get the output matrix right.
- Loading branch information
Showing
22 changed files
with
289 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { CookiesOutput } from "../../../analyzer/tests/cookies.js"; | ||
import { ALL_RESULTS, ALL_TESTS } from "../../../constants.js"; | ||
import { SCORE_TABLE, TEST_TOPIC_LINKS } from "../../../grader/charts.js"; | ||
import { SCHEMAS } from "../schemas.js"; | ||
|
||
/** | ||
* Register the API - default export | ||
* @param {import('fastify').FastifyInstance} fastify | ||
* @returns {Promise<void>} | ||
*/ | ||
export default async function (fastify) { | ||
const pool = fastify.pg.pool; | ||
|
||
fastify.get( | ||
"/recommendation_matrix", | ||
{ schema: SCHEMAS.recommendationMatrix }, | ||
async (request, reply) => { | ||
const res = ALL_RESULTS.map((output) => { | ||
return { | ||
name: output.name, | ||
title: output.title, | ||
mdnLink: TEST_TOPIC_LINKS.get(output.name) || "", | ||
results: output.possibleResults.map((pr) => { | ||
const data = SCORE_TABLE.get(pr); | ||
return data | ||
? { | ||
name: pr, | ||
scoreModifier: data.modifier, | ||
description: data.description, | ||
recommendation: data.recommendation, | ||
} | ||
: { | ||
name: pr, | ||
scoreModifier: 0, | ||
description: "", | ||
recommendation: "", | ||
}; | ||
}), | ||
}; | ||
}); | ||
return res; | ||
} | ||
); | ||
} |
Oops, something went wrong.