The Last Days of Bootcamp

The bootcamp is just about over and I haven’t blogged in a bit.

Let’s start with a little bit about last week.

About Last Week:

Last week was mainly about planning to take the belt exam on Friday. I wrapped up a couple of assignments at the beginning of the week and by the middle of the week I was ready to work on the belt exam prep test. If I never mentioned it before – the belt exam is a test taken at the end of three weeks of every stack to test our knowledge of the stack. During the test, which are given 4 1/2 hours to complete, we get a wireframe of what we need to do and instructions of what our final product should expect to have. There’s always a login/registration page, which after a successful attempt should log a user into their page which includes things like where you can add an item such as an event, a show page – which shows more about a particular event and sometimes a table of all the events added by every user.

We took our exam Friday afternoon and I have to admit that I felt I did better at my first attempt than I have on past exams. I managed to finish deploying within the next our the test is over and was on my out the door by 7pm.

This week…so far:

The week started of with a small group in my cohort. It was our last week, which is time we spend working on a project, catching up on past material we may have didn’t grasp or couldn’t get to or retaking our belt exam if we felt the need. On Monday, there were about 5 people here from my cohort. I worked on updating my personal website and going over some stuff on my exam from Friday and making the finish product look nicer.

On Tuesday there were a couple more people that trickled in and I had a tough time concentrating because I’m very exciting for the end of the program. I received my belt exam results back and found out that I received a red belt – which in my case was 1.3 points away from a black belt. With that news, I decided I’d head home since I knew I wasn’t getting any work done. At first, I told my instructor I wasn’t going to retake but after my 30 minute train ride home, I decided to regroup and to retake on Saturday.

On Wednesday, I didn’t go in to the dojo – I wanted to stay at home to concentrate in silence so I could go over what went wrong on my exam. One of my main issues is that I had extra information in my table that didn’t need to be there – it was as if the query I had been used was looping multiple times and I found out later that that was the case. To fix this issue, I wracked my brain for hours before taking a break to run some errands since I was at home. When I returned I felt revived and went straight to my computer and got to work. Turns out I needed to to do a join and select the columns I needed from each table so I could just loop through them and get the data I needed one time instead of multiple times. Here’s the query I used:

@lend = Lender.joins(:histories).select(“lenders.first_name, lenders.last_name, lenders.email”).select(“histories.amount, histories.borrower_id, histories.lender_id”)

This query joins the Lender and History tables and selects the lender’s first and last name and email. It also selects the histories amount and id’s of both the borrower and lender. Once this was set into place, it was easy to loop through this to get the information for my table as below:

  <% @lend.each do |help| %>

      <% if help.lender_id == session[:user_id] %>

       <tr>

        <td><%= help.first_name %> <%= help.last_name %></td>

        <td><%= help.purpose %></td>

        <td><%= help.description %></td>

        <td><%= help.needed %></td>

        <td><%= help.raised %></td>

         <td><%= help.amount %></td>

      </tr>

    <% end %>

  <% end %>

I felt pretty accomplished after this – It may seem like a small feat to anyone else but it took a long process to come up with the query to use. I used my rails console to try out different queries in order to figure out which one would give me the data I needed.