Jump to content
johnmorris01

Custom Assignment Widget

Recommended Posts

Following on from: http://www.frogcommunity.com/app/os?site=custom-assignments-widget and also http://forum.froginfra.net/forum/froglearn-aa/code-snippets/6016-custom-assignment-widget from the old Forums, I was wondering if there is a way of tweaking the widget that Chris posted about to have the Subject and/or Teacher showing instead of the task description? I think it would work better for us when placed as a Dashboard item. In its default form, the student has no idea who has set the homework until they click into the homework task so being able to see the Subject at the very least would be helpful.

Thanks!

Edited by johnmorris01
Link to comment
Share on other sites

Hey @johnmorris01,

My best recommendation is to inspect the API response and look at the data structure to find the data you want. If your not sure how to do this, I really recommend @Graham Quince's tutorial on Understanding API's.
 

For example, to get the subject name, on inspection of the API response you would see that there is a subject object on the assignment object, and within that a name attribute.

{
  "assignment": {
    "subject": {
      "name": "English"
    }
  }
}

So in our code we would say:

assignment.attr('subject').name

Interestingly, the creator is not included as part of the assignment object. it is in fact a sibling attribute. I recommend that in the data converter, you move the creator into the assignment as an attribute of the assignment.

return Object.values(response).map(function(assignment) {
  assignment.assignment.creator = assignment.creator;
  
  return assignment.assignment;
});


This particular endpoint happens to be covered on the old FDP site. http://fdp.frogcommunity.com/questions/view/485/get-assignments-assigned-to-a-user
It's worth saying that we are updating our FDP API reference.

 

Hope this helps,

~Chris

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...