mms-pl / railschallenge-city-watch

Our first challenge! Build a JSON API for managing your city's emergency services.
0 stars 0 forks source link

Judge's feedback #1

Open ghost opened 9 years ago

ghost commented 9 years ago

Placeholder issue for judge's feedback.

ghost commented 9 years ago

Data model and DB:

    def call_off_responders
      responders = []
      save!
    end
    scope :resolved, -> { where.not(:resolved_at, nil) }  # untested code

...and then call it like this:

Emergency.resolved.count

Controllers

@emergency = Emergency.find_by_code(params[:id])

...or alter your route to convert the id parameter to code instead. Another judge might have more to say on this point, maybe not.

mms-pl commented 9 years ago

@railschallenge-judge04 thanks for the input. It seems I need to up my DRY skills :)

First of all, I didn't thought about using emergency_code as an virtual attribute. It's in the spec, but I see the benefit of not saving it into DB directly.

Secondly, I'm not sure about Emergency#resolved_at being a good spot to check for full_response, as it is possible to set it via request without dispatching any Responder. I used Emergency#unresolved as a numeric counter to measure if ResponderDipatcher was abble to bring all Severity to 0 (it's a numeric field with sum of remainig Severity). I will have to think about it.

About the slug. my logic was as follows:

  1. Code is assigned via request
  2. Code is returned in response, so I shouldn't manipulate it
  3. 1&2 give the possiblity to make it not-pretty / dangerous (like "f100" vs "F100")
  4. The slug is parametrized to make sure that the above won't be a problem. Can I assume, that the Senior Dev will make sure the code is always correct?

About the rest - great ideas.

ghost commented 9 years ago

I'll see if I can circle back to this sometime tomorrow. I know that doesn't leave you much time for further changes, but we have many more repos to cover this weekend with early feedback, and right now I'm working to make sure everyone gets at least one round with a judge.

Thanks again for your participation!

ghost commented 9 years ago

Verified score of 114 points on the automated scoring, based on the current master branch.

mms-pl commented 9 years ago

After much consideration, I have removed the slugs

ghost commented 9 years ago

...I'm not sure about Emergency#resolved_at being a good spot to check for full_response, as it is possible to set it via request without dispatching any Responder

This should not be the case. This test ensures that you cannot set Emergency#resolved_at during creation, and these other tests ensure that dispatch happens on creation. So it should not be possible, if you have all tests passing, to set Emergency#resolved_at without the proper Responders having already been dispatched.

mms-pl commented 9 years ago

Ok, I get it. I tried to keep the starting values of severities and that is not required by spec. Updated

ghost commented 9 years ago

Sounds good.

ghost commented 9 years ago

Your score breakdown (you placed 19th):

174 points total:

I wanted to say a special thank you to you for the conversations on Twitter. Was really cool to see the engagement, and I enjoyed interacting with you online (says the faceless, robot-like general @railschallenge account :tongue: ).

Keep your eye out for our post on what judges thought were the best solutions. We're hoping there's a lot of learning to be had. The plan is the following:

Writeup on the following:

The article summarizing the code, we're hoping, provides a lot of insight into how other programmers think, and our goal is to spread that knowledge to everyone who took the time to participate.

Thanks a million @michalsapka for participating!