Public Lab Research note


Image history: Version tracking Mapknitter

by divyabaid16 | August 14, 2019 12:43 | 55 views | 1 comments | #20530 | 55 views | 1 comments | #20530 14 Aug 12:43

Read more: i.publiclab.org/n/20530


I have added this feature as part of my GSoC program. While adding this I had a great learning experience. This post summarizes the steps of how I created this feature.

What is the feature added?

Version tracking of images. Whenever the image is created or updated/modified, a new version of this image is added to the stack of this image. When a user clicks on any of the version inside the stack, the user is reverted to that version without loosing the previous and the next version of that image. The version that the user reverts gets added up to the top of the stack.

How the version is displayed?

The first version that is displayed shows that the image is created. It displays the user name and the time of the creation of image in **ago word** form for example (Created by xyz 1 hour ago). And for the rest, it is image modification which is shown as a list of new versions which contains with it the information of the user who modified it and how much time ago it was modified.

Example of version tracking:

Let there be a Stack s which is currently empty.

Image is created and added to the stack. Let it be called the version A. Now the stack becomes : [A].

The image is modified or updated once. Now the stack becomes: [A B] where B is the version of the image added showing the first modification.

The image is updated 3 more times and thus creating 3 more versions. The stack now becomes : [A B C D E].

Now suppose the user wants the image to be as it was after the second modification, i.e C. The user clicks on C and now the image will look like how it was in the C's version. The stack now becomes: [A B C D E C].

Developing this feature

I used the gem PaperTrail to add this feature.

The main attributes and functions I used were:

  • whodunnit: Gets the user name of the user who made the changes to the image.
  • created_at: Tells the time when the modification was made.
  • event: Displays the event that caused the creation of a new version in the stack (I have only added a new version to the stack when the image was created or updated).
  • item_id: Gives each version a unique number.
  • version_imit: Limits the total number of the version created for a particular image.

To know about the exact implements and the tests performed refer to thisPull Request.


1 Comments

Nice post Divya. You can also include the Gif you posted in the PR :)

Reply to this comment...


Login to comment.

Public Lab is open for anyone and will always be free. By signing up you'll join a diverse group of community researchers and tap into a lot of grassroots expertise.

Sign up