Coder Social home page Coder Social logo

Comments (13)

briri avatar briri commented on May 31, 2024

Being done as part of the data model refactoring project

from roadmap.

raycarrick-ed avatar raycarrick-ed commented on May 31, 2024

Added lock_version to answers table. This triggers optimistic locking.
If you try to save with a lock_version < the current lock_version it throws a StaleObjectException.
When an answer is saved it calls answers#update expecting a JS response.
If the save works then the JS return only updates the lock_version otherwise the next save will fail.
An empty div is added to the answer_form partial.
If a staleObject gets caught then respionse uses this to display the conflicting answer and user.
The lock_version also gets updated so that next time the user saves it will succeed.
There's a fair amount of JS which was to do with locking which is no longer needed.
The answer timestamp also gets changed. It was working of 'created_at' rather than 'updated_at' because we used to created a new answer every time.

As part of this I have also tried to rationalise the testing of question_formats. They used to always be string comps. They now use an enum field.

I had also earlier added question_format constants to avoid string comps. This was an ugly solution and can now go.

from roadmap.

raycarrick-ed avatar raycarrick-ed commented on May 31, 2024

Commits:
DigitalCurationCentre@51c78fc
DigitalCurationCentre@2a9cead
DigitalCurationCentre@a9cc1b2
DigitalCurationCentre@a6f2a54

from roadmap.

briri avatar briri commented on May 31, 2024

looks great @raycarrick-ed. moving this on to 'Ready for PR'

from roadmap.

stephaniesimms avatar stephaniesimms commented on May 31, 2024

This appears to be working as expected, however, we should consider adding a message to notify users that their answer was not saved/another user was editing the plan simultaneously. At present I receive the default timestamp message if I click Save during simultaneous editing - Answered 4 minutes ago by [email protected]

I only discover that my answer was not actually recorded when I refresh the page.
Would it be very complicated to add a message @raycarrick-ed ?

from roadmap.

raycarrick-ed avatar raycarrick-ed commented on May 31, 2024

Pulling this back to 'in progress' so I can revisit this

from roadmap.

briri avatar briri commented on May 31, 2024

this was addresses by fixes made for #241

from roadmap.

stephaniesimms avatar stephaniesimms commented on May 31, 2024

The message looks great and answers save/overwrite as expected. It's still too easy to accidentally overwrite a collaborator's answer, however. In the screenshot below, if I click "Save" without deleting or combining my answer text in the lower box as advised, it overwrites the answer in the upper box.

Since we think this is an edge case, maybe it's not worth messing w/now. We can target this for future usability testing. What do you think @sjDCC ?

screen shot 2017-04-24 at 5 26 43 pm

from roadmap.

sjDCC avatar sjDCC commented on May 31, 2024

Yes, I agree this is a good case for future usability testing. People are likely to just hit save so it'd be easy to overwrite without incorporating changes. I also got confused about where the new text should go - in the top or bottom box (even though the guidance is clear when I re-read!).

Perhaps we need to add an additional bit of guidance text like:

"The edits in the box below will overwrite the existing answer from [user name] once you click save"

from roadmap.

stephaniesimms avatar stephaniesimms commented on May 31, 2024

@sjDCC I like your suggestion about amending the message:
"The edits in the box below will overwrite the existing answer from [user name] once you click save"

from roadmap.

sjDCC avatar sjDCC commented on May 31, 2024

Possibly grey out top box suggested by @vyruss

from roadmap.

briri avatar briri commented on May 31, 2024

Updated the messaging per @sjDCC suggestion above and greyed out/disabled the text box to prevent further confusion.
screen shot 2017-04-26 at 1 40 29 pm

from roadmap.

stephaniesimms avatar stephaniesimms commented on May 31, 2024

This looks good for now. Closing issue.

from roadmap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.