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

EDUCATOR-4353 - ui - show override history #99

Merged
merged 1 commit into from Jul 10, 2019

Conversation

Andytr1
Copy link
Contributor

@Andytr1 Andytr1 commented Jul 2, 2019

No description provided.

@Andytr1 Andytr1 requested a review from reillz10 July 2, 2019 13:29
@TravisBuddy

This comment has been minimized.

@Andytr1 Andytr1 force-pushed the andytr1/gradebook-show-override-history branch 2 times, most recently from ef81580 to 53f5e90 Compare July 9, 2019 13:18
@Andytr1 Andytr1 requested a review from matthugs July 9, 2019 13:19
@TravisBuddy
Copy link

Travis tests have failed

Hey @Andytr1,
Please read the following log in order to understand the failure reason.
It'll be awesome if you fix what's wrong and commit the changes.

Node.js: lts/*

View build log

npm run test
> @edx/gradebook@0.1.0 test /home/travis/build/edx/gradebook
> jest --coverage --passWithNoTests

PASS src/data/actions/roles.test.js
PASS src/data/actions/grades.test.js
FAIL src/data/reducers/grades.test.js
  ● grades reducer › has initial state

    expect(received).toEqual(expected)
    
    Expected value to equal:
      {"errorFetching": false, "finishedFetching": false, "gradeFormat": "percent", "gradeOverrideHistoryResults": [], "headings": [], "nextPage": null, "prevPage": null, "results": [], "showSpinner": true, "showSuccess": false, "startedFetching": false}
    Received:
      {"errorFetching": false, "finishedFetching": false, "gradeFormat": "percent", "gradeOverrideCurrentEarnedAllOverride": null, "gradeOverrideCurrentEarnedGradedOverride": null, "gradeOverrideCurrentPossibleAllOverride": null, "gradeOverrideCurrentPossibleGradedOverride": null, "gradeOverrideHistoryResults": [], "headings": [], "nextPage": null, "prevPage": null, "results": [], "showSpinner": true, "showSuccess": false, "startedFetching": false}
    
    Difference:
    
    - Expected
    + Received
    
    @@ -1,9 +1,13 @@
      Object {
        "errorFetching": false,
        "finishedFetching": false,
        "gradeFormat": "percent",
    +   "gradeOverrideCurrentEarnedAllOverride": null,
    +   "gradeOverrideCurrentEarnedGradedOverride": null,
    +   "gradeOverrideCurrentPossibleAllOverride": null,
    +   "gradeOverrideCurrentPossibleGradedOverride": null,
        "gradeOverrideHistoryResults": Array [],
        "headings": Array [],
        "nextPage": null,
        "prevPage": null,
        "results": Array [],

      84 | describe('grades reducer', () => {
      85 |   it('has initial state', () => {
    > 86 |     expect(grades(undefined, {})).toEqual(initialState);
      87 |   });
      88 | 
      89 |   it('updates fetch grades request state', () => {
      
      at Object.toEqual (src/data/reducers/grades.test.js:86:35)

  ● grades reducer › updates fetch grades request state

    expect(received).toEqual(expected)
    
    Expected value to equal:
      {"errorFetching": false, "finishedFetching": false, "gradeFormat": "percent", "gradeOverrideHistoryResults": [], "headings": [], "nextPage": null, "prevPage": null, "results": [], "showSpinner": true, "showSuccess": false, "startedFetching": true}
    Received:
      {"errorFetching": false, "finishedFetching": false, "gradeFormat": "percent", "gradeOverrideCurrentEarnedAllOverride": null, "gradeOverrideCurrentEarnedGradedOverride": null, "gradeOverrideCurrentPossibleAllOverride": null, "gradeOverrideCurrentPossibleGradedOverride": null, "gradeOverrideHistoryResults": [], "headings": [], "nextPage": null, "prevPage": null, "results": [], "showSpinner": true, "showSuccess": false, "startedFetching": true}
    
    Difference:
    
    - Expected
    + Received
    
    @@ -1,9 +1,13 @@
      Object {
        "errorFetching": false,
        "finishedFetching": false,
        "gradeFormat": "percent",
    +   "gradeOverrideCurrentEarnedAllOverride": null,
    +   "gradeOverrideCurrentEarnedGradedOverride": null,
    +   "gradeOverrideCurrentPossibleAllOverride": null,
    +   "gradeOverrideCurrentPossibleGradedOverride": null,
        "gradeOverrideHistoryResults": Array [],
        "headings": Array [],
        "nextPage": null,
        "prevPage": null,
        "results": Array [],

       95 |     expect(grades(undefined, {
       96 |       type: STARTED_FETCHING_GRADES,
    >  97 |     })).toEqual(expected);
       98 |   });
       99 | 
      100 |   it('updates fetch grades success state', () => {
      
      at Object.toEqual (src/data/reducers/grades.test.js:97:9)

  ● grades reducer › updates fetch grades success state

    expect(received).toEqual(expected)
    
    Expected value to equal:
      {"courseId": "course-v1:edX+DemoX+Demo_Course", "errorFetching": false, "finishedFetching": true, "gradeFormat": "percent", "gradeOverrideHistoryResults": [], "headings": [{"name": "exam"}, {"name": "homework2"}], "nextPage": "testNextUrl", "prevPage": "testPrevUrl", "results": [{"course_id": "course-v1:edX+DemoX+Demo_Course", "email": "user1@example.com", "letter_grade": null, "percent": 0.5, "section_breakdown": [{"displayed_value": "0.00", "grade_description": "(0.00/0.00)", "percent": 0, "score_earned": 0, "score_possible": 0, "subsection_name": "Demo Course Overview"}, {"displayed_value": "1.00", "grade_description": "(0.00/0.00)", "percent": 1, "score_earned": 1, "score_possible": 1, "subsection_name": "Example Week 1: Getting Started"}], "user_id": 1, "username": "user1"}, {"course_id": "course-v1:edX+DemoX+Demo_Course", "email": "user22@example.com", "letter_grade": null, "percent": 0, "section_breakdown": [{"displayed_value": "0.00", "grade_description": "(0.00/0.00)", "percent": 0, "score_earned": 0, "score_possible": 0, "subsection_name": "Demo Course Overview"}, {"displayed_value": "0.00", "grade_description": "(0.00/0.00)", "percent": 0, "score_earned": 1, "score_possible": 1, "subsection_name": "Example Week 1: Getting Started"}], "user_id": 22, "username": "user22"}], "selectedCohort": 2, "selectedTrack": "verified", "showSpinner": false, "showSuccess": false, "startedFetching": false}
    Received:
      {"courseId": "course-v1:edX+DemoX+Demo_Course", "errorFetching": false, "finishedFetching": true, "gradeFormat": "percent", "gradeOverrideCurrentEarnedAllOverride": null, "gradeOverrideCurrentEarnedGradedOverride": null, "gradeOverrideCurrentPossibleAllOverride": null, "gradeOverrideCurrentPossibleGradedOverride": null, "gradeOverrideHistoryResults": [], "headings": [{"name": "exam"}, {"name": "homework2"}], "nextPage": "testNextUrl", "prevPage": "testPrevUrl", "results": [{"course_id": "course-v1:edX+DemoX+Demo_Course", "email": "user1@example.com", "letter_grade": null, "percent": 0.5, "section_breakdown": [{"displayed_value": "0.00", "grade_description": "(0.00/0.00)", "percent": 0, "score_earned": 0, "score_possible": 0, "subsection_name": "Demo Course Overview"}, {"displayed_value": "1.00", "grade_description": "(0.00/0.00)", "percent": 1, "score_earned": 1, "score_possible": 1, "subsection_name": "Example Week 1: Getting Started"}], "user_id": 1, "username": "user1"}, {"course_id": "course-v1:edX+DemoX+Demo_Course", "email": "user22@example.com", "letter_grade": null, "percent": 0, "section_breakdown": [{"displayed_value": "0.00", "grade_description": "(0.00/0.00)", "percent": 0, "score_earned": 0, "score_possible": 0, "subsection_name": "Demo Course Overview"}, {"displayed_value": "0.00", "grade_description": "(0.00/0.00)", "percent": 0, "score_earned": 1, "score_possible": 1, "subsection_name": "Example Week 1: Getting Started"}], "user_id": 22, "username": "user22"}], "selectedAssignmentType": undefined, "selectedCohort": 2, "selectedTrack": "verified", "showSpinner": false, "showSuccess": false, "startedFetching": false}
    
    Difference:
    
    - Expected
    + Received
    
    @@ -1,10 +1,14 @@
      Object {
        "courseId": "course-v1:edX+DemoX+Demo_Course",
        "errorFetching": false,
        "finishedFetching": true,
        "gradeFormat": "percent",
    +   "gradeOverrideCurrentEarnedAllOverride": null,
    +   "gradeOverrideCurrentEarnedGradedOverride": null,
    +   "gradeOverrideCurrentPossibleAllOverride": null,
    +   "gradeOverrideCurrentPossibleGradedOverride": null,
        "gradeOverrideHistoryResults": Array [],
        "headings": Array [
          Object {
            "name": "exam",
          },
    @@ -66,10 +70,11 @@
            ],
            "user_id": 22,
            "username": "user22",
          },
        ],
    +   "selectedAssignmentType": undefined,
        "selectedCohort": 2,
        "selectedTrack": "verified",
        "showSpinner": false,
        "showSuccess": false,
        "startedFetching": false,

      126 |       showSpinner: true,
      127 |       courseId,
    > 128 |     })).toEqual(expected);
      129 |   });
      130 | 
      131 |   it('updates toggle grade format state success', () => {
      
      at Object.toEqual (src/data/reducers/grades.test.js:128:9)

  ● grades reducer › updates toggle grade format state success

    expect(received).toEqual(expected)
    
    Expected value to equal:
      {"errorFetching": false, "finishedFetching": false, "gradeFormat": "percent", "gradeOverrideHistoryResults": [], "headings": [], "nextPage": null, "prevPage": null, "results": [], "showSpinner": true, "showSuccess": false, "startedFetching": false}
    Received:
      {"errorFetching": false, "finishedFetching": false, "gradeFormat": "percent", "gradeOverrideCurrentEarnedAllOverride": null, "gradeOverrideCurrentEarnedGradedOverride": null, "gradeOverrideCurrentPossibleAllOverride": null, "gradeOverrideCurrentPossibleGradedOverride": null, "gradeOverrideHistoryResults": [], "headings": [], "nextPage": null, "prevPage": null, "results": [], "showSpinner": true, "showSuccess": false, "startedFetching": false}
    
    Difference:
    
    - Expected
    + Received
    
    @@ -1,9 +1,13 @@
      Object {
        "errorFetching": false,
        "finishedFetching": false,
        "gradeFormat": "percent",
    +   "gradeOverrideCurrentEarnedAllOverride": null,
    +   "gradeOverrideCurrentEarnedGradedOverride": null,
    +   "gradeOverrideCurrentPossibleAllOverride": null,
    +   "gradeOverrideCurrentPossibleGradedOverride": null,
        "gradeOverrideHistoryResults": Array [],
        "headings": Array [],
        "nextPage": null,
        "prevPage": null,
        "results": Array [],

      138 |       type: TOGGLE_GRADE_FORMAT,
      139 |       formatType: formatTypeData,
    > 140 |     })).toEqual(expected);
      141 |   });
      142 | 
      143 |   it('updates filter columns state success', () => {
      
      at Object.toEqual (src/data/reducers/grades.test.js:140:9)

  ● grades reducer › updates filter columns state success

    expect(received).toEqual(expected)
    
    Expected value to equal:
      {"errorFetching": false, "finishedFetching": false, "gradeFormat": "percent", "gradeOverrideHistoryResults": [], "headings": [{"name": "exam"}, {"name": "homework2"}], "nextPage": null, "prevPage": null, "results": [], "showSpinner": true, "showSuccess": false, "startedFetching": false}
    Received:
      {"errorFetching": false, "finishedFetching": false, "gradeFormat": "percent", "gradeOverrideCurrentEarnedAllOverride": null, "gradeOverrideCurrentEarnedGradedOverride": null, "gradeOverrideCurrentPossibleAllOverride": null, "gradeOverrideCurrentPossibleGradedOverride": null, "gradeOverrideHistoryResults": [], "headings": [{"name": "exam"}, {"name": "homework2"}], "nextPage": null, "prevPage": null, "results": [], "showSpinner": true, "showSuccess": false, "startedFetching": false}
    
    Difference:
    
    - Expected
    + Received
    
    @@ -1,9 +1,13 @@
      Object {
        "errorFetching": false,
        "finishedFetching": false,
        "gradeFormat": "percent",
    +   "gradeOverrideCurrentEarnedAllOverride": null,
    +   "gradeOverrideCurrentEarnedGradedOverride": null,
    +   "gradeOverrideCurrentPossibleAllOverride": null,
    +   "gradeOverrideCurrentPossibleGradedOverride": null,
        "gradeOverrideHistoryResults": Array [],
        "headings": Array [
          Object {
            "name": "exam",
          },

      150 |       type: FILTER_COLUMNS,
      151 |       headings: expectedHeadings,
    > 152 |     })).toEqual(expected);
      153 |   });
      154 | 
      155 |   it('updates update_banner state success', () => {
      
      at Object.toEqual (src/data/reducers/grades.test.js:152:9)

  ● grades reducer › updates update_banner state success

    expect(received).toEqual(expected)
    
    Expected value to equal:
      {"errorFetching": false, "finishedFetching": false, "gradeFormat": "percent", "gradeOverrideHistoryResults": [], "headings": [], "nextPage": null, "prevPage": null, "results": [], "showSpinner": true, "showSuccess": true, "startedFetching": false}
    Received:
      {"errorFetching": false, "finishedFetching": false, "gradeFormat": "percent", "gradeOverrideCurrentEarnedAllOverride": null, "gradeOverrideCurrentEarnedGradedOverride": null, "gradeOverrideCurrentPossibleAllOverride": null, "gradeOverrideCurrentPossibleGradedOverride": null, "gradeOverrideHistoryResults": [], "headings": [], "nextPage": null, "prevPage": null, "results": [], "showSpinner": true, "showSuccess": true, "startedFetching": false}
    
    Difference:
    
    - Expected
    + Received
    
    @@ -1,9 +1,13 @@
      Object {
        "errorFetching": false,
        "finishedFetching": false,
        "gradeFormat": "percent",
    +   "gradeOverrideCurrentEarnedAllOverride": null,
    +   "gradeOverrideCurrentEarnedGradedOverride": null,
    +   "gradeOverrideCurrentPossibleAllOverride": null,
    +   "gradeOverrideCurrentPossibleGradedOverride": null,
        "gradeOverrideHistoryResults": Array [],
        "headings": Array [],
        "nextPage": null,
        "prevPage": null,
        "results": Array [],

      161 |     expect(grades(undefined, {
      162 |       type: OPEN_BANNER,
    > 163 |     })).toEqual(expected);
      164 |   });
      165 | 
      166 |   it('updates fetch grades failure state', () => {
      
      at Object.toEqual (src/data/reducers/grades.test.js:163:9)

  ● grades reducer › updates fetch grades failure state

    expect(received).toEqual(expected)
    
    Expected value to equal:
      {"errorFetching": true, "finishedFetching": true, "gradeFormat": "percent", "gradeOverrideHistoryResults": [], "headings": [], "nextPage": null, "prevPage": null, "results": [], "showSpinner": true, "showSuccess": false, "startedFetching": false}
    Received:
      {"errorFetching": true, "finishedFetching": true, "gradeFormat": "percent", "gradeOverrideCurrentEarnedAllOverride": null, "gradeOverrideCurrentEarnedGradedOverride": null, "gradeOverrideCurrentPossibleAllOverride": null, "gradeOverrideCurrentPossibleGradedOverride": null, "gradeOverrideHistoryResults": [], "headings": [], "nextPage": null, "prevPage": null, "results": [], "showSpinner": true, "showSuccess": false, "startedFetching": false}
    
    Difference:
    
    - Expected
    + Received
    
    @@ -1,9 +1,13 @@
      Object {
        "errorFetching": true,
        "finishedFetching": true,
        "gradeFormat": "percent",
    +   "gradeOverrideCurrentEarnedAllOverride": null,
    +   "gradeOverrideCurrentEarnedGradedOverride": null,
    +   "gradeOverrideCurrentPossibleAllOverride": null,
    +   "gradeOverrideCurrentPossibleGradedOverride": null,
        "gradeOverrideHistoryResults": Array [],
        "headings": Array [],
        "nextPage": null,
        "prevPage": null,
        "results": Array [],

      172 |     expect(grades(undefined, {
      173 |       type: ERROR_FETCHING_GRADES,
    > 174 |     })).toEqual(expected);
      175 |   });
      176 | });
      177 | 
      
      at Object.toEqual (src/data/reducers/grades.test.js:174:9)

PASS src/data/actions/assignmentTypes.test.js
PASS src/data/actions/tracks.test.js
PASS src/data/actions/cohorts.test.js
PASS src/data/reducers/assignmentTypes.test.js
PASS src/data/reducers/tracks.test.js
PASS src/data/reducers/cohorts.test.js
PASS src/data/reducers/roles.test.js
[BABEL] Note: The code generator has deoptimised the styling of "/home/travis/build/edx/gradebook/node_modules/@edx/paragon/themeable/index.js" as it exceeds the max of "500KB".
PASS src/components/PageButtons/PageButtons.test.jsx (5.301s)
--------------------------------|----------|----------|----------|----------|-------------------|
File                            |  % Stmts | % Branch |  % Funcs |  % Lines | Uncovered Line #s |
--------------------------------|----------|----------|----------|----------|-------------------|
All files                       |    40.49 |    34.27 |     35.4 |    40.49 |                   |
 src                            |        0 |        0 |        0 |        0 |                   |
  postcss.config.js             |        0 |      100 |      100 |        0 |                 2 |
  segment.js                    |        0 |        0 |        0 |        0 |... 74,75,76,80,84 |
 src/components/Gradebook       |        0 |        0 |        0 |        0 |                   |
  index.jsx                     |        0 |        0 |        0 |        0 |... 74,490,536,558 |
 src/components/Header          |        0 |      100 |      100 |        0 |                   |
  index.jsx                     |        0 |      100 |      100 |        0 |        1,2,4,8,14 |
 src/components/PageButtons     |       60 |      100 |    33.33 |       60 |                   |
  index.jsx                     |       60 |      100 |    33.33 |       60 |             21,35 |
 src/config                     |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 src/containers/GradebookPage   |        0 |        0 |        0 |        0 |                   |
  index.jsx                     |        0 |        0 |        0 |        0 |... 26,28,31,70,86 |
 src/data                       |     5.26 |      100 |        0 |     5.26 |                   |
  apiClient.js                  |      100 |      100 |      100 |      100 |                   |
  store.js                      |        0 |      100 |        0 |        0 |... 20,32,40,50,53 |
 src/data/actions               |    68.29 |    53.33 |    55.42 |    70.37 |                   |
  assignmentTypes.js            |      100 |      100 |      100 |      100 |                   |
  cohorts.js                    |      100 |      100 |      100 |      100 |                   |
  grades.js                     |    43.37 |    35.71 |    20.45 |    47.76 |... 14,215,216,218 |
  roles.js                      |      100 |      100 |      100 |      100 |                   |
  tracks.js                     |      100 |      100 |      100 |      100 |                   |
  utils.js                      |    76.19 |       50 |    66.67 |    76.19 |      7,8,10,15,27 |
 src/data/constants/actionTypes |      100 |      100 |      100 |      100 |                   |
  assignmentTypes.js            |      100 |      100 |      100 |      100 |                   |
  cohorts.js                    |      100 |      100 |      100 |      100 |                   |
  grades.js                     |      100 |      100 |      100 |      100 |                   |
  roles.js                      |      100 |      100 |      100 |      100 |                   |
  tracks.js                     |      100 |      100 |      100 |      100 |                   |
 src/data/reducers              |    74.51 |    77.78 |      100 |    74.51 |                   |
  assignmentTypes.js            |      100 |      100 |      100 |      100 |                   |
  cohorts.js                    |      100 |      100 |      100 |      100 |                   |
  grades.js                     |     62.5 |       50 |      100 |     62.5 |... 99,104,109,115 |
  index.js                      |        0 |      100 |      100 |        0 |     1,3,4,5,6,7,9 |
  roles.js                      |      100 |      100 |      100 |      100 |                   |
  tracks.js                     |      100 |      100 |      100 |      100 |                   |
 src/data/selectors             |        0 |        0 |        0 |        0 |                   |
  tracks.js                     |        0 |        0 |        0 |        0 |               1,2 |
 src/data/services              |       50 |    33.33 |       50 |       50 |                   |
  LmsApiService.js              |       50 |    33.33 |       50 |       50 |... 86,88,93,94,95 |
--------------------------------|----------|----------|----------|----------|-------------------|

Test Suites: 1 failed, 10 passed, 11 total
Tests:       7 failed, 37 passed, 44 total
Snapshots:   4 passed, 4 total
Time:        11.624s
Ran all test suites.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @edx/gradebook@0.1.0 test: `jest --coverage --passWithNoTests`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @edx/gradebook@0.1.0 test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/travis/.npm/_logs/2019-07-09T13_20_39_031Z-debug.log
TravisBuddy Request Identifier: 73edcf90-a24c-11e9-bee2-e9a995d9559a

@Andytr1 Andytr1 force-pushed the andytr1/gradebook-show-override-history branch from 53f5e90 to e192e8f Compare July 9, 2019 13:33
@@ -98,4 +98,8 @@

.mb-85 {
margin-bottom: 85px;
}

.modal-dialog {
Copy link
Contributor

Choose a reason for hiding this comment

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

We might want to change the specificity of this. This will change the max-widths of all modals that we can use in our application which isn't desirable. Unfortunately, from the quick look I took, it seems as though the modal component gets placed at the top of the DOM so I'm not exactly sure its possible without editing the Modal component in paragon. @matthugs do you have any thoughts on this?

Copy link
Contributor

Choose a reason for hiding this comment

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

Discussed offline using the parentSelector prop of paragon's modal component to achieve this (using portals!) https://edx.github.io/paragon/?path=/story/modal--basic-usage

@@ -433,13 +443,40 @@ export default class Gradebook extends React.Component {
open={this.state.modalOpen}
title="Edit Grades"
closeText="Cancel"
body={(
body={( // UI for this component
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove this comment. If you don't that it is clear that the jsx there is for the component, please turn it into a React functional component that way it can be referenced by a name: https://reactjs.org/docs/components-and-props.html

src/components/Gradebook/index.jsx Outdated Show resolved Hide resolved
src/components/Gradebook/index.jsx Outdated Show resolved Hide resolved
src/containers/GradebookPage/index.jsx Outdated Show resolved Hide resolved
data.override.possible_graded_override,
));
})
.catch(() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

If the Linter lets you, remove this catch block entirely. If it doesnt at least remove the comments.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would probably add a StatusAlert that reports this issue to the educator, actually https://edx.github.io/paragon/?path=/story/statusalert--basic-usage

They're pretty quick to roll up; could show it in place of where the table would've shown

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For now, I used the existing pattern of dispatching errorFetching...

Copy link
Contributor

Choose a reason for hiding this comment

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

But why did you do that? It seems as though this changes an errorFetching thing in our store but doesn't result in anything on the UI. Unless I'm missing something here. ...

src/data/actions/grades.js Outdated Show resolved Hide resolved
src/data/actions/grades.js Outdated Show resolved Hide resolved
src/data/reducers/grades.js Outdated Show resolved Hide resolved
src/data/reducers/grades.js Outdated Show resolved Hide resolved
Copy link
Contributor

@reillz10 reillz10 left a comment

Choose a reason for hiding this comment

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

Sorry, I accidentally approved the last one. I didn't mean to. Please make all of the changes I mentioned in my other review before merging

data.override.possible_graded_override,
));
})
.catch(() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would probably add a StatusAlert that reports this issue to the educator, actually https://edx.github.io/paragon/?path=/story/statusalert--basic-usage

They're pretty quick to roll up; could show it in place of where the table would've shown

dispatch(gotGradeOverrideHistory(
formatGradeOverrideForDisplay(data.history), data.override.earned_all_override,
data.override.possible_all_override, data.override.earned_graded_override,
data.override.possible_graded_override,
Copy link
Contributor

Choose a reason for hiding this comment

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

I would pass along the subsectionId & userId we loaded this from as well, so that the reducer can keep track of which combinations have been loaded already, saving us from needing to hit the backend & make the user wait each time they switch which grade they're viewing.

Some pieces of the puzzle to doing that: a second argument is also provided to invoked thunks alongside dispatch; getState enables you to read from state to determine how you want your thunk to behave. E.g. if we wanted to read from a portion of state to determine whether we need to load data, we can get a reference to state by invoking that function. Simple example here: https://github.com/reduxjs/redux-thunk#motivation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Future enhancement, probably

Copy link
Contributor

Choose a reason for hiding this comment

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

I have a formal rule about this sort of code review discussion: if you are pushing off work for the future, show me tickets or I know you're lying ;).

If you could drop something in Jira linking back to this discussion then I'm more than happy to mark this as resolved.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

src/data/actions/grades.js Show resolved Hide resolved
src/data/services/LmsApiService.js Outdated Show resolved Hide resolved
data={this.state.modalModel}
columns={[{ label: 'Date', key: 'date' }, { label: 'Grader', key: 'grader' },
{ label: 'Reason', key: 'reason' },
{ label: 'Adjusted grade', key: 'adjustedGrade' }]}
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like we should move this to a CONSTANT

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What would be the benefit of constant? I found an example in the file on line 284 creating a const userInformationHeadingLabel. Is this the same thing?

Copy link
Contributor

Choose a reason for hiding this comment

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

To make intention clearer, and to make the code easier to read. It calls out an assumption, and pulls it up to a different point in code where it might be reused/moved to where it could be even more widely reused if necessary.

E.g. we could validate that the props provided to our component doesn't contain data that doesn't fit in these columns. Or we could calculate the column labels & the corresponding propTypes from the same, larger data structure, reducing duplicating this list in multiple places.

@Andytr1 Andytr1 force-pushed the andytr1/gradebook-show-override-history branch from e192e8f to 32a692b Compare July 9, 2019 19:32
@Andytr1 Andytr1 requested review from reillz10 and matthugs and removed request for MichaelRoytman July 10, 2019 12:11
@Andytr1 Andytr1 force-pushed the andytr1/gradebook-show-override-history branch from 32a692b to b37ab08 Compare July 10, 2019 14:43
Copy link
Contributor

@reillz10 reillz10 left a comment

Choose a reason for hiding this comment

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

I saw the errorFetchingGradeOverrideHistory event and I'm confused as to why thats there since it doesn't seem the errorFetching state isn't even mapped to props. That seems like a copy pasta of some code that should be cleaned up. That said, it sounds like @matthugs suggests that you put a statusAlert in there of some sort if there is an error. That can be up to you guys and product/ux to figure out the right behavior. For this PR, either fix that or remove this unused boilerplate for my thumbs up.

}

.grade-history-assignment{
padding-right: 49px;
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: These class names are super misleading and we would be better suited with more utility classes such as a pr-49 or something like that. That said, this is fine for now and can be refactored later.

data.override.possible_graded_override,
));
})
.catch(() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

But why did you do that? It seems as though this changes an errorFetching thing in our store but doesn't result in anything on the UI. Unless I'm missing something here. ...

updated unit tests

EDUCATOR-4353 - major improvements to service etc

remove unused

unit tests fix

code review continued

update unit test after merge

code review - showing error dialog
@Andytr1 Andytr1 force-pushed the andytr1/gradebook-show-override-history branch from b37ab08 to 2913f1d Compare July 10, 2019 18:08
type="text"
name="reasonForChange"
value={this.state.reasonForChange}
onChange={value => this.onChange(value)}
Copy link
Contributor

Choose a reason for hiding this comment

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

One teachable moment point (I promise I'll space these out better in the future). If you define the function you're calling like this

  onChange = (e) => {
    this.setState({ [e.target.name]: e.target.value });
  }

then this can become

Suggested change
onChange={value => this.onChange(value)}
onChange={this.onChange}

and you don't have to create a new function just to call another function with this set to the correct thing. This isn't particularly important, but understanding why this works can help you understand the difference between a function function and an =>/"arrow" function.

updateUserId: userEntry.user_id,
});
onChange(e) {
this.setState({ [e.target.name]: e.target.value });
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: I would prefer a more explicit approach to writing these handlers, i.e. two separate & specifically named methods which handle only their specific use cases and can't be repurposed into something else.

I generally prefer to be very concrete in this sort of context. This method doesn't encapsulate enough to be worth abstracting.

}]}
/>)}

<div>Showing most recent actions(max 5). To see more, please contact
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<div>Showing most recent actions(max 5). To see more, please contact
<div>Showing most recent actions (max 5). To see more, please contact

dispatch(gotGradeOverrideHistory(
formatGradeOverrideForDisplay(data.history), data.override.earned_all_override,
data.override.possible_all_override, data.override.earned_graded_override,
data.override.possible_graded_override,
Copy link
Contributor

Choose a reason for hiding this comment

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

I have a formal rule about this sort of code review discussion: if you are pushing off work for the future, show me tickets or I know you're lying ;).

If you could drop something in Jira linking back to this discussion then I'm more than happy to mark this as resolved.

Copy link
Contributor

@matthugs matthugs left a comment

Choose a reason for hiding this comment

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

Thanks for your attentiveness to our feedback; great work!

Copy link
Contributor

@reillz10 reillz10 left a comment

Choose a reason for hiding this comment

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

👍

@Andytr1 Andytr1 merged commit 7dc1ffd into master Jul 10, 2019
@kdmccormick kdmccormick deleted the andytr1/gradebook-show-override-history branch July 16, 2020 19:55
dyudyunov pushed a commit to dyudyunov/frontend-app-gradebook that referenced this pull request Oct 12, 2022
…dary

Render ErrorPage component via app-level error boundary.
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.

None yet

4 participants