title: Canvas API - why would all of the count values be "undefined" for rating_sum?
body: <p>I need to accomplish a (seemingly) simple task using a Google Sheet and data that I extract from <a href="https://community.canvaslms.com/" rel="nofollow noreferrer">Canvas</a></p>
  
  <p><strong>Determine the discussion post like count by student</strong></p>
  
  <p>For example:</p>
  
  <ul>
  <li>Student A posts to a discussion board </li>
  <li>Student B hits the like button on Student A's post </li>
  <li>I need to see a count of 1 for Student B's action</li>
  </ul>
  
  <p>This is what I have done so far...</p>
  
  <p>I found these two examples and used them as my starting point:</p>
  
  <p><a href="https://community.canvaslms.com/groups/canvas-developers/blog/2016/01/02/how-to-count-student-discussion-posts" rel="nofollow noreferrer">How to Count Student Discussion Posts</a></p>
  
  <ul>
  <li>This works flawlessly</li>
  <li>I am able to count student discussion board posts</li>
  <li>I verified that the counts are accurate</li>
  <li>Below is the code snippet I am working with</li>
  </ul>
  
  <pre><code>if (typeof users[userId] !== 'undefined') {
    if (typeof counts[userId] === 'undefined') {
      counts[userId] = 1;
    }
    else {
      counts[userId]++;
    }
  }
  </code></pre>
  
  <p><a href="https://community.canvaslms.com/thread/34180-extracting-discussion-post-likes-by-student" rel="nofollow noreferrer">Extracting Discussion Post Likes By Student?</a></p>
  
  <ul>
  <li>This is what I am trying to solve for</li>
  <li>Below is the code snippet I am working with</li>
  </ul>
  
  <pre><code>if (typeof users[userId] !== 'undefined' &amp;&amp; typeof entries[entry].rating_sum !== 'undefined') {
    if (typeof counts[userId] === 'undefined') {
      counts[userId] = entries[entry].rating_sum;
    }
    else {
      counts[userId] += entries[entry].rating_sum;
    }
  }
  </code></pre>
  
  <p>Initially, this returned no results...which was strange because I have verified manually that there are in fact a number of likes for student posts...and my first test that just counts all discussion board posts returns an accurate count.</p>
  
  <p>I adapted the code to return everything regardless of the <code>entries[entry].rating_sum</code> value</p>
  
  <pre><code>if (typeof users[userId] !== 'undefined') {
    if (typeof counts[userId] === 'undefined') {
      counts[userId] = entries[entry].rating_sum;
    }
    else {
      counts[userId] += entries[entry].rating_sum;
    }
  }
  </code></pre>
  
  <p>What I am seeing is that all <code>entries[entry].rating_sum</code> values are 'undefined'</p>
  
  <p>I am not sure how to determine the root cause - I believe the code is working as expected</p>
  
  <p>Your insights are appreciated</p>
  
  <p>Thanks!</p>