# GSoC 2016: Final Work Product of Expanded Q & A System for publiclab.org

by ananyo2012 | | 950 views | 10 comments |

ananyo2012 was awarded the Basic Barnstar by warren for their work in this research note.

So we nearly come to the end of GSoC 2016 and its time for the Final Work Product Submission. This research note contains all the work that I completed over this summer on my Project on Expanded Q & A system for publiclab.org.

## Project Details

Project Title: Expanded Q & A system for publiclab.org

Abstract/Summary: Developing proper Q & A system for Publiclab.org with improved User Experience.

Open source Platform Used: Github

Github Organization Page: Publiclab

Repository Contributed to: plots2

Languages/Framework Used: Ruby on Rails, JavaScript(jQuery), HTML/CSS

Open Pull request: #40 on PublicLab.Editor

Here is an image of the Contribution graph Starting from the very first day of GSoC Project announcement. Find it at this link

### First-timer-only Issues

One of the good things about plots2 codebase is that it is really encouraging for first-timers who have either haven't contributed to open-source or have very little experience on it. It has some great issues labelled as first-timer-only which is really encouraging for first-timers. We have also made some during the summer. They can found in the link given below.

Link to first-timer-only issues: https://github.com/publiclab/plots2/labels/first-timers-only

## Project Description

Here are the list of features that I worked on throughout the summer.

### Listing all questions in the Questions Landing page

As the feature image of this post shows, you can now see all questions at https://publiclab.org/questions. The questions are listed chronologically according to the date when they were posted. The Recently answered tab shows all questions that have been answered recently. The Popular tab shows all questions arranged by the number of views. The Liked tab shows all questions according to the number of likes to each question.

### Searching questions

You can search questions by typing in the keyword in the search box present in the questions landing page. The search box is autocomplete and shows results as you type in. Here is a picture of the search feature.

You can go the question directly by clicking on the link in the typeahead.

### Sorting questions by tags

You can sort questions by tags and show only specific questions tagged by the entered tagnames using the Refine question by tags section presnt in the sidebar of the question page. Here you can enter tags and remove tags and the questions gets sorted accordingly. Also you can clear all tags using the Clear all tags link. Here is how it looks

For posting a new question you can type in the question title in the same search form and then Press the Ask button beside. It takes you to the question editor(login required). The question editor is the same editor that is used to post reasearch notes on publiclab.org but with a slightly customized sidebar. Here is a picture of the question editor while writing a question

Here you can write questions and also edit a already created question. The questions are mainly classified as questions based on a power tags which is of the format question:topic. Where topic refers to the question topic which relates it. You can change this topic by changing the question:question tag which is already provided at the tags section of the editor.

### Viewing question

On clicking the question link the question shows. Here is a picture of the question page.

Let me just give the run down of all the specific features present in the page. You can see a button named Subscribe to answer questions on this topic. Subscribing it notifies you on any question on this topic. Apart from that there is a Follow button where you can follow other tags related to this question. There is a Star button beside it where you can Like that question. Liking the question notifies you on any conversations and answers posted for that question. Beside that a dropdown button is present which upon clicking shows a pop up where you have the edit and delete buttons for the question.

Below that you can see the user who asked the asked along with the number of views, likes and answers. Then there is the content below which there are tags for that question along with a tag form for adding more tags.

Below that there is the answer section which is discussed separately in this post. Apart from that the sidebar displays some more information dicussed in this subsection.

#### Sidebar of question page

The sidebar contains Ask question buttons from where you can ask new or related question. After that the answerers fo the question are listed sorted by the no of answers. On hovering over the users the no of answers given by them is displayed. After that comes the Related questions section where all questions related with same tags as the question are listed.

As you can see in the image above the answers section comes below the question body. You can post a new answer to the question using the Answer editor present at the end of all answers. The answer editor is similar to the question editor and contains toolbar for editing it. You can write descriptive answers on it using a markdown based editor and also post images. Here is a sample image of an answer

It has the answer author mentioned along with the time ago when it was posted. Edit and delete buttons are present at the right edge. An Accept answer button is present below the question which shows if you are the question author. The question author can accept an answer which seems to answer his question. A green Accepted label is shown for the answer when it is accepted as you can see in the question view above. Also a green answered label is shown beside the question in the question landing page. The question author can also unaccept the answer through the same button.

### Commenting system

A new commenting system is introduced with the Q & A pages. Comments are intended for clarifications regarding the question or answer. They have limited markdown support. Here is a image of comments listed below answers

The authoring interface contains a expandable comment box that increases in height as you type in.

Part from that comments are foldable and only a limited no of comments appear initially you can view more comments using the View # more comments button which also shows the no of comments yet to show. You can also get the link to the comments from the date that contains the comment link. In case you want to browse a specific comment and the comment is hidden in the chain the entire comments chain open up showing the comment.

Email notifications are sent to users on various events of posting a question, answer or comment. Users get custom email notifications for posting questions. email notifications are also be sent for each new answers posted, to the question author and users who liked the question and to those who also posted an answer to the question. You can mention users using the @ symbol using their usernames. When a new comment is posted for an answer notification is sent to the answer author, those mentioned in the comment, those who liked the answer and others involved in the conversation. Creating views for these email notifications was another task while creating the email notification system.

### Q & A in User Profile

A new Questions section is included in the User Profile page. It list the Asked and Answered questions. You can go to any user profile to check this out. Checkout my profile in publiclab.org. Here are the images for Asked and Answered questions in my profile

You can toggle between the two sections using the Asked and Answered buttons. The Answered section has a Answers by User toggle button that displays the link only to the answers by the user to that question below which a link to all answers are given. The section can be toggled as shown in the image above.

### Questions section in tags page

The tags page now contain a separate questions section which can be seen in this link https://publiclab.org/questions/tag/spectrometer.

Apart from that an important task was to separate out questions and reasearch notes and list them separately in different areas such as tags and Profile pages, since questions are basically notes tagged with a question:topic tag.

### A failed attempt to integrate friendly_id

A part of my Project Proposal mentions the use of friendly_id for handling url changes when the title for any post changes. plots2 already had a system to handle the url formats of wiki pages, maps and research notes but it didn't update the url in case the title for them changed since in that case the old urls for them would be lost which we definitely don't want. friendly_id had a way to handle these url changes and redirect any old urls to the new one using it's History module.Though I did work on it but there was a huge bug that creeped up and all the old urls were lost. Luckily PublicLab has good database backups and all data was revived after reverting some of the friendly_id changes. There are still code left to re-implement the feature if needed after we come with more good tests and careful implementation so that things like this don't happen in future.

### Few works on PublicLab Rich Editor

This was the only part of my project that I couldn't much work on. Though I have worked on some of it. The Rich Editor is a different project and the repository is at PublicLab.Editor. I updated the rich editor template used in the publiclab website. Also I made a Pull Request #40 recently, on updating the readme of the repository.

### Writing tests for implemented changes

Last but not the least one of the important part of my Project was to write good tests for all the implemented changes. Writing good tests is one of the necessary part for every good open project so that newly implemented changes don't break the current working of the application. Rails has its own testing framework test::unit. All tests for plots2 are written in it. So that is the one that was used by me during the Project.

Also recently we setup Jasmine in plots2 repository for testing javascript features. So I also wrote some javascript specs for testing some of the javascript related functionality.

## Other Issues

There are also many issues that I worked on apart from my Project before and during Coding period. These are some of the unrelated issues which I worked during Coding period apart from the Q & A Project: #570, #503, #16, #577, #624, #656, #668, #604

## Ongoing development

Except some minor issues and some works on the Rich Editor Project most work is complete as per the Proposed Timeline. You can find all issues related to the Q & A project at https://github.com/publiclab/plots2/milestone/4. It also contains some first-timer-only issues.

The next step is working on the PublicLab Rich Editor. This is in its early stage and has lots to be done. A lot many ideas come up to customize its use for Q & As. I have a an open Pull Request #40 in the PublicLab.Editor repository which I hope to be merged soon.

Also more ideas for improving the Q & A system and its interface is always welcome and I will always be in a hunch to solve them!

Apart from this I also wrote some of the documentation during my Project which can be found in the links given below

That's all Folks! It was really great working with the PublicLab GSoC team throughout this summer and it was a really valuable experience for me.

This looks great, Ananyo, thanks for all your incredible work! Not necessary for the Monday deadline, but I wonder if you might add a brief section on first-timers-only issues and your work on those, which has recently shown some great success?

Is this a question? Click here to post it to the Questions page.

Also, I'm sort of collecting small issues, and especially HTML-based ones, that would make good first-timers-only issues. Here's what I've got so far:

Ok Jeff! Just including them. In fact I will be making one more soon!

Also, oh my gosh, Ananyo, I didn't know you'd been blogging in so much detail about the work! https://ilovefoss.wordpress.com/category/gsoc/ is great!

Also I have created a new Q & A Project milestone to list all the issues that relate to the Q & A Project. I have include it above: https://github.com/publiclab/plots2/milestone/4

Thanks Jeff! I have been blogging during first half of my Project! I thought of sharing it with everyone once it was complete. Hope to add more of my GSoC experiences to it! :-)

Wow, this and your blog (obviously on top of all the excellent work you've put in) is awesome! Thanks for everything, Ananyo :)

Hi, Ananyo -- just going through all the projects one by one now.

I wanted to thank you once again for such great work this summer -- you've been involved very actively in many different aspects of the codebase, even well outside of your own work, and without neglecting your own project. You've been very responsive and communicative, both to me and to other students -- and even to new contributors who've picked up your first-timers-only posts.

Your level of documentation, thoroughness and responsiveness, going as far as to fix other peoples' bugs, is impressive and deeply appreciated. I was gratified to see your quick and thoughtful responses to my input on your new features and designs. I also want to note that your positive and constructive attitude, even in the face of complex or difficult challenges, made it a pleasure to work with you at all times.

Finally, with regard to the friendly_id project, I know that was a tough one, but given the complexity of the task, its involvement of poorly documented legacy code, and the difficulty of working with legacy data, I think it could have been much worse -- and the rapid response to the difficulties that ensued was excellent. All in all, I appreciate that you sought to reform and revise this system that really did need it, and that you've worked to document next steps should we try to make a new attempt. Again, this was outside the scope of your project and did not in any way affect the completion of your planned work.

To sum up -- exemplary work, and I hope to work with you more! The Q&A system is already seeing heavy use and we anticipate it'll be a major part of Public Lab's future! Thanks!

warren awards a barnstar to ananyo2012 for their awesome contribution!

Thanks Jeff for your appreciation! You have been greatly helpful for me as well as other students throughout the summer. You have been working so hard along with us! Its been great working you and the whole Public Lab team. And to mention I really like the spirit of collective work Public Lab has. I got the feedback and response not only from the GSoC team but also from others in the community and it really feels great to see everyone involved. This has helped me learn a lot and I have a lot of experience contributing to open source now! Yes I too hope to contribute more to Public lab in future. In fact I am learning to contribute to the Rich Editor and hope to see its launch soon! Thanks again and excited for the September Open hour!