Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(stats): remove old satisfaction rate #3241

Merged
merged 1 commit into from
Jan 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ test("return stats", async () => {
expect(response.status).toBe(200);
expect(response.body).toMatchInlineSnapshot(`
Object {
"feedback": Object {
"negative": 2,
"positive": 3,
},
"nbDocuments": 26,
"nbPageViews": 10,
"nbSearches": 4,
Expand Down
17 changes: 2 additions & 15 deletions packages/code-du-travail-api/src/server/routes/stats/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ const methodParams = [
{
method: "Actions.get",
},
{
label: ["negative", "positive"],
method: "Events.getAction", // transform into label[]=
},
];

router.get("/stats", async (ctx) => {
Expand All @@ -77,18 +73,9 @@ router.get("/stats", async (ctx) => {
for (const { doc_count } of buckets) {
nbDocuments += doc_count;
}
const [nbVisitData, infoData, feedbackData] = await Promise.all(promises);
const positiveFeedback = feedbackData.find((f) => f.label === "positive") || {
nb_events: 0,
};
const negativeFeedback = feedbackData.find((f) => f.label === "negative") || {
nb_event: 0,
};
const [nbVisitData, infoData] = await Promise.all(promises);

ctx.body = {
feedback: {
negative: negativeFeedback.nb_events,
positive: positiveFeedback.nb_events,
},
nbDocuments,
nbPageViews: infoData.nb_pageviews,
nbSearches: infoData.nb_searches,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1493,25 +1493,6 @@ exports[`<Stats /> should render 1`] = `
</div>
</div>
</li>
<li
class="c32"
>
<div
class="c33 c34"
>
<h3
class="c35"
>
Taux de satisfaction
</h3>
<div
class="c36"
>
60
%
</div>
</div>
</li>
</ul>
</div>
</div>
Expand Down
11 changes: 0 additions & 11 deletions packages/code-du-travail-frontend/pages/stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,6 @@ const Stats = ({ data }) => {
<Heading>Consultations</Heading>
<Num>{data.nbPageViews}</Num>
</Tile>

<Tile variant="dark">
<Heading>Taux de satisfaction</Heading>
<Num>
{Math.round(
(100 * data.feedback.positive) /
(data.feedback.positive + data.feedback.negative)
)}
%
</Num>
</Tile>
</Grid>
<p>
Statistiques d’utilisation depuis le{" "}
Expand Down