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

Pc reports page #62

Merged
merged 15 commits into from
Aug 8, 2023
Merged

Pc reports page #62

merged 15 commits into from
Aug 8, 2023

Conversation

pconrad
Copy link
Contributor

@pconrad pconrad commented Aug 7, 2023

Overview

In this PR, we create a reports page where the Admin can view reports created by the InstructorReport job.

Merge these PRs first

Issues Addressed

Closes #18

Link to Storybook

TODO link to storybook

Details

This PR finishes work on the first draft of creating instructor reports.

  • There is a backend endpoint where the instructor can request all reports.
  • The instructor can request an instructor report on the jobs page, for all commons, or a specific commons
  • There is a job that could be scheduled (though it may not be scheduled yet) to run these reports periodically (e.g. once a day, twice a day, etc.)
  • The instructor can view all reports that have been generated on the Admin / Reports page at /admin/reports
  • There is a link on the Navbar Admin dropdown for Reports that takes the user to /admin/reports
  • The instructor can select a report and view the report detail at /admin/reports/:report_id; that page uses the ReportHeaderTable and ReportDetailTable to show the results.

Test Plan (for interactive testing)

  1. Create a user commons or two. Have a low capacity so that health will go down with relatively few cows.
  2. Have at least two users join one of the user commons
  3. Generate a report
  4. Have users buy some cows (enough to be over capacity), and run the Milk The Cows and or Cow Health update jobs a few times, alternating with generating reports.
  5. View the reports page and see if the reports reflect the changes over time.

@pconrad pconrad marked this pull request as draft August 7, 2023 17:19
@pconrad pconrad marked this pull request as ready for review August 8, 2023 00:37
Copy link
Contributor Author

@pconrad pconrad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider removing these commented out lines

Copy link
Contributor

@GDW1 GDW1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im approving but i just put some minor style considerations

@@ -9,6 +10,18 @@ export const parameters = {
actions: { argTypesRegex: "^on[A-Z].*" },
}

const currentUrl = window.location.href;
const isLocalhost = currentUrl.startsWith("http://localhost:6006/");
const mockServiceWorkerUrl = isLocalhost ? "mockServiceWorker.js" : "https://" + window.location.hostname + "/mockServiceWorker.js";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im skeptical whether it is best practice to put ternary in a const var

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We discussed, and decided to leave this as it is.


self.addEventListener('fetch', function (event) {
const { request } = event
const accept = request.headers.get('accept') || ''
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider using booleans instead of strings for readability

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is "do not touch" code from msw framework.

frontend/public/mockServiceWorker.js Show resolved Hide resolved
@@ -7,8 +7,11 @@ import LeaderboardPage from "main/pages/LeaderboardPage";
import AdminUsersPage from "main/pages/AdminUsersPage";
import AdminJobsPage from "main/pages/AdminJobsPage";
import AdminCreateCommonsPage from "main/pages/AdminCreateCommonsPage";
import AdminViewReportPage from "main/pages/AdminViewReportPage";

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra line for a reason?

@pconrad pconrad merged commit dc90a9c into main Aug 8, 2023
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FEATURE: Instructor Report - generate a comprehensive report
2 participants