Optimistic Locking
- add bit field to question_format so we don't have to test strings to determine format - add isOptionBased to question so we dn't have to do multiple string comps for this - there was a boolean already in the DB not being used - add migration to add bit field - add migration to add lock_version field to answer - change answers_controller to do optimistic locking - change answers controller not to redirect to plans/phase/edit as it wasn't doing anything - introduced answers/update.js.erb to handle the return from /answers/update. - to do the conflict resolution you need the old answer and new answer objects. Tried using clone but it doesn't work because it only does a shallow copy. So adopted a "nuclear-option" deep copy but it's a bit much. A compromise would be better. |
---|
|
app/controllers/answers_controller.rb |
---|
app/models/answer.rb |
---|
app/models/question.rb |
---|
app/models/question_format.rb |
---|
app/views/answers/update.js.erb 0 → 100644 |
---|
app/views/phases/_answer.html.erb 0 → 100644 |
---|
app/views/phases/_answer_form.html.erb |
---|
app/views/phases/edit.html.erb |
---|
db/migrate/20170227122226_add_locking_columns.rb 0 → 100644 |
---|
db/migrate/20170301105806_add_type_column_to_question_format.rb 0 → 100644 |
---|
db/schema.rb |
---|
lib/assets/javascripts/plans.js |
---|
lib/assets/stylesheets/bootstrap_and_overrides.css.less |
---|