Jump to content

Bulk creation of homework's (assignments)

Recommended Posts

We are currently looking at how we could use assignments to better support learning.  We are considering all staff using assignments in frog for some or all homework.

I have been asked about the possibility of bulk assignment creation from excel or a google sheet (which is where details of homework are typically stored now).

I think there are a number of steps needed to accomplish this...

1. Bring the external records into frog

2. For each record in turn

          a) create a site (sites.create)

          b) update the site (create a page to 'host' the assignment - sites.update)

          c) create an assignment using the site just created (assignments.create)


Thanks to the tutorial on 'using firebase with frog' step 1 is done.

Based on another tutorial on here: 'understanding frog api' I have made a start on step 2a.  However, I believe that sites.create requires the form data to be POSTED rather than attached as a GET request.  This would make it different to other Frog.model.api examples on this forum. I have been trying (unsuccessfully) variations to the code below to get the data "posted" to the end point.  If this is the problem then can anyone shed any light on the correct syntax?





Edited by pconkie
  • Like 2
Link to comment
Share on other sites

Hi @pconkie,

You are almost there!

      page: [],
      quiet: true,
      name: 'test66',
      description: 'my description',
      theme: '7397AE892002C4FABE0FAFC9D06525054B7A007C5EV5C06D'
      type: 'POST'
  ).done(function(thisResponse) {
	var site = thisResponse.data.site;

The third parameter is the options we want to send to jQuery to tell it how to send the request to the server! 

For more information, check out the api method's documentation here - https://froglearn.backwellschool.net/app/lib/packaging/docs/Com.Frog.Model.html 

Hope this helps,



Link to comment
Share on other sites

Actually - I still have no joy with this code......

It now posts the required parameters to the end point and I have what appears to be identical request headers, but the response returned is code: 1000 (An internal error has occurred).


Left hand side is my code, right hand side is frog

And the response (left my code, right frog)....


I can't see a difference between the two.

Is there another reason why code on a html widget might generate the error?





Link to comment
Share on other sites

Hi @pconkie,

Sorry about that. It appears that your specified theme uuid is incorrect, odd that the information coming back is not entirely useful. Correct your theme uuid and it should work for you.

You could also try a different method of programmatically creating sites. Unfortunately, we haven't written the documentation for this part of the system yet, so there will be an element of blind programming here.

// We need the createsite component; if its not loaded, then get it
// once loaded, run the function passed into .then()
steal('//frogui/components/createsite/createsite.js').then(function() {
    var $el = $('<div />'); // Create a virtual element to "host" the component.

    $el.on('createsite.created', function(ev, site) {
        // A site is born!
    $el.on('createsite.error', function() {
        // error handling code goes here

    new Frogui.Controllers.Components.Createsite($el, {
        quiet: true,
        title: 'test45785d',
        launchOnCreate: false,
        theme: '7397AE892002C4FABE0FAFC9D06525054B7A007C5EV5C06D',
        description: 'my description',
        pages: [{
            sequence: 0,
            name: 'Page 1',
            layout: 'F7B77DAF2002B37FD67E3F8F9EF9F50BFFB6EE2C088C91F6',
            parent_uuid: null,
            buckets: []

This approach is more complex but offers you can easy way of building the pages out. There is a lot of async code happening here, which will require a delicate hand to manage as I imagine you are gonna be looping through loads of data. If you would like more information on this approach let me know.

Hope this helps :)

~ Chris

  • Like 1
Link to comment
Share on other sites

Thanks again Chris, I must have checked that theme id ten times!

All working great now.

I like the alternative method above as it combines step 2a and 2b from my original post (and i don't need to pass a page uuid, which seems to be needed for sites.update)

I know what you mean about async issues, ta.


  • Like 1
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.

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...