{"action":"opened","issue":{"url":"https://api.github.com/repos/randofrst/pwp-capstones/issues/1","repository_url":"https://api.github.com/repos/randofrst/pwp-capstones","labels_url":"https://api.github.com/repos/randofrst/pwp-capstones/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/randofrst/pwp-capstones/issues/1/comments","events_url":"https://api.github.com/repos/randofrst/pwp-capstones/issues/1/events","html_url":"https://github.com/randofrst/pwp-capstones/issues/1","id":362420082,"node_id":"MDU6SXNzdWUzNjI0MjAwODI=","number":1,"title":"We have to account for null values in the denominator as well as the numerator","user":{"login":"jmcrey","id":16808761,"node_id":"MDQ6VXNlcjE2ODA4NzYx","avatar_url":"https://avatars2.githubusercontent.com/u/16808761?v=4","gravatar_id":"","url":"https://api.github.com/users/jmcrey","html_url":"https://github.com/jmcrey","followers_url":"https://api.github.com/users/jmcrey/followers","following_url":"https://api.github.com/users/jmcrey/following{/other_user}","gists_url":"https://api.github.com/users/jmcrey/gists{/gist_id}","starred_url":"https://api.github.com/users/jmcrey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmcrey/subscriptions","organizations_url":"https://api.github.com/users/jmcrey/orgs","repos_url":"https://api.github.com/users/jmcrey/repos","events_url":"https://api.github.com/users/jmcrey/events{/privacy}","received_events_url":"https://api.github.com/users/jmcrey/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-09-21T01:00:49Z","updated_at":"2018-09-21T01:00:49Z","closed_at":null,"author_association":"NONE","body":"https://github.com/randofrst/pwp-capstones/blob/fa0c4b19972b807a162b37e1d8a5fb790056f50b/TomeRater/TomeRater.py#L17-L22\r\n\r\nWe do a great job at filtering out all the null values from the numerator; we just have to apply this same concept to the denominator as well. Since we are filtering from the top, remember to filter those same values from the bottom so that we can keep our values consistent. \r\n\r\nFor example, we can implement this like so:\r\n\r\n```\r\ndef get_average_rating(self): \r\n     total = 0 \r\n     total_books = 0\r\n     for rating in self.books.values(): \r\n         if type(rating) == int: \r\n             total += rating \r\n             total_books += 1\r\n     return total / total_books\r\n```"}}
{"actor":{"display_login":"jmcrey"}}