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

Generate non csf certificates #14027

Merged
merged 7 commits into from
Mar 29, 2017
Merged

Generate non csf certificates #14027

merged 7 commits into from
Mar 29, 2017

Conversation

Hamms
Copy link
Contributor

@Hamms Hamms commented Mar 27, 2017

Note that the design of the core image - the way the title wraps around the name field - means that particularly long names will overlap the title:

image

However, also note that a quick look at the data confirms that we rarely need to deal with names over 20 characters
teacher hist

And names in that range fit just fine:

image

Note also that the facilitator names are implemented by stacking them, meaning that with a particularly large number of facilitators we could run into similar problems, but it would take quite a few for us to get to that point, and three facilitators (the maximum expected number) fit quite comfortably:

image

Copy link
Contributor

@mehalshah mehalshah left a comment

Choose a reason for hiding this comment

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

General comments

  • Eyes test for this would be great, seems like the best way to see if we broke anything
  • A sanity check controller test would be great as well
  • Any reason not to fold CSF controller into this piece?
  • Do we need to have access control restrictions on who can print a certificate? Right now I don't think we do but it's

@@ -11,5 +11,7 @@ def generate_certificate
)

send_data image.to_blob, type: 'image/png', disposition: 'inline'
ensure
image && image.destroy!
Copy link
Contributor

Choose a reason for hiding this comment

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

image.try(:destroy!) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

why?

workshop = @enrollment.workshop

facilitator_names = workshop.facilitators.map {|f| f.name.strip}
facilitator_fields = facilitator_names.each_with_index.map do |name, i|
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any ordering of facilitator names we should do? Ask the PLC team this

Copy link
Contributor Author

@Hamms Hamms left a comment

Choose a reason for hiding this comment

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

  • Sure!
  • Sure!
  • Only that what I really want to do is entirely fold create_certificate_image2 into this new method, but that's used in enough other places that that work really justifies its own PR
  • I don't know; do we? Are things like facilitator names considered private?

@@ -11,5 +11,7 @@ def generate_certificate
)

send_data image.to_blob, type: 'image/png', disposition: 'inline'
ensure
image && image.destroy!
Copy link
Contributor Author

Choose a reason for hiding this comment

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

why?

@Hamms
Copy link
Contributor Author

Hamms commented Mar 28, 2017

PTAL.

Note that I cherry-picked a commit from this pending PR to help with the eyes test

@Hamms Hamms merged commit f549d41 into staging Mar 29, 2017
@Hamms Hamms deleted the generate-non-csf-certificates branch March 29, 2017 18:42
@aoby
Copy link
Contributor

aoby commented Mar 29, 2017

Reverting because the new eyes test is failing with

Mysql2::Error: Field 'pd_workshop_id' doesn't have a default value: INSERT INTO `pd_enrollments` (`first_name`, `last_name`, `email`, `created_at`, `updated_at`, `code`, `school_info_id`) VALUES ('TestTeacher9681c657a0', 'Last - 11881f3a76b76d9aec1ce1639d281398', 'user@example.com', '2017-03-29 21:21:44', '2017-03-29 21:21:44', '9c3d780510496b97eaf2', 2) (ActiveRecord::StatementInvalid)
./step_definitions/pd.rb:89:in `create_enrollment'
./step_definitions/pd.rb:162:in `/^I create a workshop for course "([^"]*)" ([a-z]+) by "([^"]*)" with (\d+) (people|facilitators)(.*)$/'
./step_definitions/pd.rb:42:in `/^I am a teacher who has just followed a workshop certificate link$/'
./support/hooks.rb:36:in `call'
./support/hooks.rb:36:in `block in '
features/pd/workshopCertificates.feature:7:in `Given I am a teacher who has just followed a workshop certificate link'
./step_definitions/pd.rb:89:in `create_enrollment'
./step_definitions/pd.rb:162:in `/^I create a workshop for course "([^"]*)" ([a-z]+) by "([^"]*)" with (\d+) (people|facilitators)(.*)$/'
./step_definitions/pd.rb:42:in `/^I am a teacher who has just followed a workshop certificate link$/'
./support/hooks.rb:36:in `call'
./support/hooks.rb:36:in `block in '
features/pd/workshopCertificates.feature:7:in `Given I am a teacher who has just followed a workshop certificate link'
./step_definitions/pd.rb:89:in `create_enrollment'
./step_definitions/pd.rb:162:in `/^I create a workshop for course "([^"]*)" ([a-z]+) by "([^"]*)" with (\d+) (people|facilitators)(.*)$/'
./step_definitions/pd.rb:42:in `/^I am a teacher who has just followed a workshop certificate link$/'
./support/hooks.rb:36:in `call'
./support/hooks.rb:36:in `block in '
features/pd/workshopCertificates.feature:7:in `Given I am a teacher who has just followed a workshop certificate link'
./step_definitions/pd.rb:89:in `create_enrollment'
./step_definitions/pd.rb:162:in `/^I create a workshop for course "([^"]*)" ([a-z]+) by "([^"]*)" with (\d+) (people|facilitators)(.*)$/'
./step_definitions/pd.rb:42:in `/^I am a teacher who has just followed a workshop certificate link$/'
./support/hooks.rb:36:in `call'
./support/hooks.rb:36:in `block in '
features/pd/workshopCertificates.feature:7:in `Given I am a teacher who has just followed a workshop certificate link'
./step_definitions/pd.rb:89:in `create_enrollment'
./step_definitions/pd.rb:162:in `/^I create a workshop for course "([^"]*)" ([a-z]+) by "([^"]*)" with (\d+) (people|facilitators)(.*)$/'
./step_definitions/pd.rb:42:in `/^I am a teacher who has just followed a workshop certificate link$/'
./support/hooks.rb:36:in `call'
./support/hooks.rb:36:in `block in '
features/pd/workshopCertificates.feature:7:in `Given I am a teacher who has just followed a workshop certificate link'
./step_definitions/pd.rb:89:in `create_enrollment'
./step_definitions/pd.rb:162:in `/^I create a workshop for course "([^"]*)" ([a-z]+) by "([^"]*)" with (\d+) (people|facilitators)(.*)$/'
./step_definitions/pd.rb:42:in `/^I am a teacher who has just followed a workshop certificate link$/'
./support/hooks.rb:36:in `call'
./support/hooks.rb:36:in `block in '
features/pd/workshopCertificates.feature:7:in `Given I am a teacher who has just followed a workshop certificate link'

See https://cucumber-logs.s3.amazonaws.com/test/test/ChromeLatestWin7_pd_workshopCertificates_eyes_output.html?versionId=9KwLd3lA0Bxl1aAh5x8Q_Ms_1gwbUBXP

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants