{"issue":{"created_at":"2011-12-12T04:59:04Z","state":"closed","updated_at":"2011-12-13T10:24:32Z","comments":3,"user":{"gravatar_id":"9a3dad7dee673587fc28ff52ed8222ab","id":475423,"url":"https://api.github.com/users/conejoninja","login":"conejoninja","avatar_url":"https://secure.gravatar.com/avatar/9a3dad7dee673587fc28ff52ed8222ab?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"body":"That helper is not working on detail page","assignee":{"gravatar_id":"9a3dad7dee673587fc28ff52ed8222ab","id":475423,"url":"https://api.github.com/users/conejoninja","login":"conejoninja","avatar_url":"https://secure.gravatar.com/avatar/9a3dad7dee673587fc28ff52ed8222ab?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"id":2519532,"labels":[{"name":"Bug","color":"e10c02","url":"https://api.github.com/repos/osclass/OSClass/labels/Bug"}],"number":79,"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"title":"osc_item_views() not working on item page","html_url":"https://github.com/osclass/OSClass/issues/79","closed_at":"2011-12-13T10:24:32Z","url":"https://api.github.com/repos/osclass/OSClass/issues/79","milestone":{"created_at":"2011-11-24T18:04:39Z","state":"open","closed_issues":5,"due_on":null,"creator":{"gravatar_id":"1b8217884d085436bbb7d56b96b8570c","id":296442,"url":"https://api.github.com/users/juanramon","login":"juanramon","avatar_url":"https://secure.gravatar.com/avatar/1b8217884d085436bbb7d56b96b8570c?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"number":3,"description":"","title":"2.4","url":"https://api.github.com/repos/osclass/OSClass/milestones/3","open_issues":15}},"action":"created","comment":{"created_at":"2011-12-13T10:24:32Z","updated_at":"2011-12-13T10:24:32Z","user":{"gravatar_id":"9a3dad7dee673587fc28ff52ed8222ab","id":475423,"url":"https://api.github.com/users/conejoninja","login":"conejoninja","avatar_url":"https://secure.gravatar.com/avatar/9a3dad7dee673587fc28ff52ed8222ab?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"body":"Fixed, We added a check on osc_item_views to know is the variable is defined or not since we were not retrieve views data on every query. We decided to do so, so performance will be the same on 99% of the cases, the other solution was to add the views data on every request of an item object. Views data implies a SUM and a JOIN, so overall performance will drop. Instead, as I said, we check if views is defined or not, in case it's not, we do a new query to retrieve it.\r\n\r\n\r\nThe only problem of this solution is that the code is not as nice and clean as adding it on every query, and it could have worse performance if views data is requested for a lot of items on the same page (for example on search results if you requested over 100 items).\r\n\r\n\r\nAs a side note, unfortunately it couldn't make it to 2.3.3 version, but it's already on hotfixes and develo pbranch for the next version.\r\nAlso, a new method was created on ItemStats model, named getViews($itemId), which returns the number of views given the ID of an item","id":3121322,"url":"https://api.github.com/repos/osclass/OSClass/issues/comments/3121322"}}