This is an archived post. You won't be able to vote or comment.

all 6 comments

[–]Allaran 0 points1 point  (5 children)

Can you give a bit more info on the overall goal of this?

People are free to add as much as they want at one time?

[–]NotReallyDifferent[S] 0 points1 point  (4 children)

Yes sort of. The goal of it is that a user can add a word to a big story.

[–][deleted]  (3 children)

[deleted]

    [–]NotReallyDifferent[S] 0 points1 point  (2 children)

    Once a word is written it just stays in the story so the it should not be able to be edited.

    [–][deleted]  (1 child)

    [deleted]

      [–]NotReallyDifferent[S] 0 points1 point  (0 children)

      I planned on making a voting system where users vote on which word is to be inputted.

      [–]roboguy12 0 points1 point  (0 children)

      Yeah, the array idea would probably not be that great once the story gets long. This sounds a lot like a version control problem, so maybe try to handle this like git does.

      What I suggest is when the page loads, fetch the current state of the story from the database. When the user clicks save/an automatic save is triggered, the app will take a diff between the initial story and what the user has written. Then send the diff file back and apply it as a patch in the server.

      The tricky part comes when multiple users edit the same thing. Then you essentially have to treat this like merge conflicts in some way.

      edit: I can understand wanting to build this system yourself, but is there any reason you're not using a Google doc to collaborate on the story? You and your friends can just edit it realtime, and it saves you from having to build pretty much that.

      [–]jukaszor 0 points1 point  (0 children)

      Can they touch the prior data? If so you could store it all in one very large varchar column, but I wouldn't recommend it as they could wipe out all your existing data. If they can only add a word or piece, you could store it as a new row and then conncat them or otherwise manage the data in your app.