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.
dev
1 parent a43aaa8 commit 51c78fcb7271491a0f4f6dcc7407967cb34a0a9b
@ray.carrick ray.carrick authored on 1 Mar 2017
Showing 13 changed files
View
app/controllers/answers_controller.rb
View
app/models/answer.rb
View
app/models/question.rb
View
app/models/question_format.rb
View
app/views/answers/update.js.erb 0 → 100644
View
app/views/phases/_answer.html.erb 0 → 100644
View
app/views/phases/_answer_form.html.erb
View
app/views/phases/edit.html.erb
View
db/migrate/20170227122226_add_locking_columns.rb 0 → 100644
View
db/migrate/20170301105806_add_type_column_to_question_format.rb 0 → 100644
View
db/schema.rb
View
lib/assets/javascripts/plans.js
View
lib/assets/stylesheets/bootstrap_and_overrides.css.less