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

Course survey upload failure (fa18 data) #181

Closed
jameslzhu opened this issue Feb 18, 2019 · 3 comments
Closed

Course survey upload failure (fa18 data) #181

jameslzhu opened this issue Feb 18, 2019 · 3 comments

Comments

@jameslzhu
Copy link
Member

jameslzhu commented Feb 18, 2019

mowen's been getting two errors while uploading course survey data for fa18.

There are two separate issues here:

"Instructor save failed: #<Instructor id: 5950, last_name: "Lin", picture: "", title: "Teaching Assistant", phone_number: "", email: "kevinlin@gmail.com", home_page: "", interests: "", created_at: "2011-04-15 23:29:06", updated_at: "2011-04-15 23:29:06", private: false, office: "", first_name: "Kevin">"

There are two Kevin Lins in the database. This is somehow causing an error to be thrown at csec_admin_helper.rb#L133, because Instructors are only disambiguated by first,last name, and not id.

"Could not find survey question 'Response Rate' in database"

There is an extra data point in this semester's survey, 'Response Rate'. This extra SurveyQuestion is not an entry in the database, so the lookup fails and an error is thrown at csec_admin_helper.rb#L108

@jameslzhu
Copy link
Member Author

In the future, for distinguishing instructors with identical first/last names, lacking further disambiguation (student IDs, internal survey IDs, semester heuristics), we should default to the most-recently-created instructor, or maybe instructor with the most recent course survey data (favoring instructors who last taught spring 2019 over instructors who last taught spring 2015).

@jameslzhu
Copy link
Member Author

jameslzhu commented Mar 13, 2019

It appears the error is being caused by save validations occurring after instructor.save. Specifically, it appears the validation at instructor.rb#L31 is failing when Kevin Lin is being saved:

  validates_uniqueness_of :first_name, scope: :last_name

Kevin Lin does not have a unique first name in the space of all TAs with a common last name (i.e. there is another Kevin Lin, so this validation fails, causing the course upload to fail.

The fix for this is unclear. It's also unclear how Kevin Lin created his account in the first place (manual intervention may have occurred), but it seems like the solution involves either:

  • Remove the validation (may break other sections)
  • Skip validation here, using validate: false as a parameter in instructor.save
  • Add the instructor only if newly created

The third seems like the most logically correct solution. The second seems like the most practically simple solution (but the most duct-tapey).

@jameslzhu
Copy link
Member Author

Appears to be fixed?

ochan1 pushed a commit to ochan1/hkn-rails that referenced this issue Feb 10, 2022
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

No branches or pull requests

1 participant