<human>: Can you give me a shortened version of the text?

I'm a purist, I've only read the books, not seen the movies.  I'm looking for an answer that can be given from the book and not the movies, pottermore, etc., as I feel these give JK Rowling an opportunity to backtrack or change what she's already written.  Interestingly enough, this is brought up in the book (Order of the Phoenix) and Hermione says, "...the Sorting Hat did seriously consider putting me into Ravenclaw during my sorting, but it decided on Gryffindor in the end."  To me, that's like JK Rowling saying, "Yeah, I guess I could've put her in Ravenclaw...oh well, already wrote it."

I generally like the books and look forward to reading them to my kids one day.  It's just this one thing that sticks in my brain and I can't shake loose.  Why would JK create such an intricate world and then have such a glaring flaw as the smartest student not put into the house for smart people?
<bot>: Using only the books as evidence, explain why it was better for the character/storyline of Hermione to be in Gryffindor rather than Ravenclaw.