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

Get workshops information in detail view #19929

Merged
merged 11 commits into from Jan 12, 2018

Conversation

mehalshah
Copy link
Contributor

@mehalshah mehalshah commented Jan 11, 2018

  • Augment the workshop serializer to provide a friendly short name for the dropdown

  • Build a SummerWorkshopPicker loader to call the workshop filter and get all summer workshops

  • Augment filter to allow for multiple subjects (we may want to do this for other workshop criteria

  • Restyle the control because I didn't like it

  • Fix all the tests I broke

@mehalshah mehalshah requested a review from aoby January 11, 2018 05:08
@mehalshah
Copy link
Contributor Author

image

handleScoreChange: PropTypes.func,
courseName: PropTypes.string,
assignedWorkshopId: PropTypes.number,
handleSelectedWorkshopChange: PropTypes.func
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: typically event (callback) props are named onAction and the event handlers (functions) are named handleAction. That's how the React docs show it. Unless there's a reason to break convention here, I'd prefer these to follow it (i.e. rename lines 35 and 38 from handle to on).

}

state = {
loading: true
Copy link
Contributor

Choose a reason for hiding this comment

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

this does not appear to be used

// We aren't testing any of the responses of the workshop selector control, so just
// return success for all requests for the time being to suppress the warning message
// in the test output
sinon.fakeServer.create();
Copy link
Contributor

Choose a reason for hiding this comment

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

note - the comment isn't quite accurate. This won't return anything (success or otherwise). It creates a stub server, but unless you set a response this will simply not return from the API calls. Therefore it won't hit your done callbacks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okay - I don't have any done callbacks at the time so I'm fine with the fake server. I'll just fix the comment

@@ -334,6 +334,12 @@ def friendly_name
"#{course_subject} workshop on #{start_time} at #{location_name}"[0...255]
end

def short_name
return '' unless sessions.size && processed_location
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think you want sessions.size here. In Ruby, 0 is truthy:

irb(main):006:0> !!0
=> true
irb(main):007:0> !0
=> false

Maybe sessions.any? ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also this seems kind of specific to the teachercon / summer workshop view. I'm not sure that short_name is entirely appropriate. We already have a friendly_name and this isn't necessarily shorter. I think this might better belong in the serializer.

Or if we want to leave it in the model, at least name it more appropriately: something like friendly_date_and_location_name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm fine moving this to the serializer

@mehalshah mehalshah merged commit b67ad31 into staging Jan 12, 2018
@@ -128,7 +128,7 @@ def get_applications_by_role(role)

def application_params
params.require(:application).permit(
:status, :notes, :regional_partner_filter, :response_scores, :locked
:status, :notes, :regional_partner_filter, :response_scores, :locked, :pd_workshop_id
Copy link
Contributor

Choose a reason for hiding this comment

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

This is causing an error in production:

ActiveModel::UnknownAttributeError: unknown attribute 'pd_workshop_id' for Pd::Application::Facilitator1819Application.

@balderdash balderdash deleted the get_workshops_information_in_detail_view branch September 20, 2018 17:47
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

2 participants