Survey-Rails Project

I planned to write this post yesterday, but getting my wisdom teeth out hurt a lot more than I expected.

Anyways, I have been working on this project for the past couple of weeks and I think I have gotten it to a point that I am happy with.

Check out the github and survey-rails test site.

This was a good project to work on because it involved many models working togethere and also included heavy ajax which was something I needed to learn. In this website, a user can log in or create an account. From there, they can create surveys, take surveys, and see the stats of the results of their surveys.

What I learned:

  1. One of the most important bits of information I learned was that by adding
    		 remote: true
    to my forms, it would automatically submit via ajax. This saved me time from having to write the ajax for each submit.

  2. After making my own flash messages on the last project, I experimented with toastr messages which are a lot cleaner and look nicer than the ones I was making.

  3. By using 6 models in the website, it forced me to think about how each model was interacting and how I could connect them.

  4. I also experimented with foundation icons (which don't seem to work all the time on the test site, but do locally). They added a nice touch to the site and make it easier to navigate.

  5. I added a bar graph and pie graph in the stats section for each question on the survey. I used google charts which worked very well. This also was good practice for displaying data, which my next project will be on.

  6. On my route to understanding how jquery and ajax work, I had to learn more about js.erb files and how rendering works.
    		 format.js {render :file => "/questions/update.js.erb" , content_type: 'text/javascript', :locals => {:question => @question, :choice => Choice.new} }
    before doing this project, I had no idea what the render block was for but after researching it, I found the purpose. It finds the type of request being sent and matches the type to the correct response. This was useful in this project because it allowed me to give error and success messages along with updating the page.

  7. One major thing I learned during the project was performance testing. I used both a website called loader.io where I did load testing on getting pages, along side with benchmarking to test post routes. I wrote this test page which along with fixtures to test how fast the server could respond to mulitple requests.
    		# rake test:benchmark
    		SurveysTest#test_index (1.45 sec warmup)
    		           wall_time: 5 ms
    		              memory: unsupported
    		             objects: unsupported
    		             gc_runs: 0
    		             gc_time: 0 ms
    		.SurveysTest#test_submit_survey (1.64 sec warmup)
    		# ran this test 350 times
    		           wall_time: 1.54 sec
    		              memory: unsupported
    		             objects: unsupported
    		             gc_runs: 3
    		             gc_time: 105 ms
    		.SurveysTest#test_show (7 ms warmup)
    		           wall_time: 6 ms
    		              memory: unsupported
    		             objects: unsupported
    		             gc_runs: 0
    		             gc_time: 0 ms
    It also created a file to view the records in which I could use to visualize the results of the test. From the loader.io test, which tested the process of getting the survey: This result was longer than the test I ran with benchmark but it was on heroku which is slower than the local environment.

What I want to learn:

  1. Even though the ajax worked well most of the time, there were still on rare occasion times when it wouldn't do what I was expecting it to. I want to become better at ajax and jquery so I can make my projects as easy to use as possible.

  2. I also want to learn more about the asset pipeline because I have a feeling that is the reason why the icons aren't working in production.

Feedback from testing:

I had few people test the site and got their feedback. For tech savy people like my friend and my brother, there was no issues at all really with the site. But for less inclined people like my mother, there was a bit more of an issue. For the next project, I will have to find a balance bewteen making the site fool proof and not overdoing it with instructions. Most of the issue for the non tech savvy people came with creating the survey form. I though about changing the form to make it easier to use but after looking at the edit form at SurveyMonkey, I decided mine was actually better. Although theirs has more options, mine is simpler to use.

The survey monkey edit page: