Jump to content

Custom Assignment Widget


johnmorris01

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...