Jump to content

simon brahan

Former Frog Staff
  • Posts

    10
  • Joined

  • Last visited

Personal Information

  • School
    Frog Developer

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

simon brahan's Achievements

Froggy

Froggy (1/6)

  • First Post
  • Collaborator Rare

Recent Badges

4

Reputation

  1. You need to authenticate as a FrogOS Learn user to ensure your application isn't given access to permissions it shouldn't have. You should be able to log in as an admin user and then use most of Frog Learn's APIs, including the datastore ones. There are some limits to how many API calls you make in a certain amount of time; you're unlikely to hit these as they're mainly to protect against denial of service or bot attacks which will send many requests very quickly. If you do hit them we can discuss changing the limits for your instance, or providing an API that will let you do the work in fewer calls.
  2. Yes, Chris, you can use OAuth (either flavour) to communicate with FrogOS. We can add a client of either type to your Frog Learn instance through a support ticket; the client is sensitive so we can't do it through this forum. Once you have that you can create your own web app in any way you like and have it communicate with Frog Learn using the publicly available APIs listed in the documentation I provided above. Thanks for the suggestion of an SQL wrapper. We use something similar internally; however is we were to make the interface available to third parties we wouldn't be able to ensure the security, integrity or performance of our back end.
  3. Hi Chris, I'm a senior developer at Frog. Graham asked me to take a look at your questions. The core of Frog Learn uses a MySQL database behind a custom API; we keep this locked up to internal development to ensure security and integrity of the data, so it's not available for use in Frog Code development. We have a datastore API available to widget developers that allows you to store and work with server side data specific to your widgets, you can see the documentation for this at the following address on your Frog Learn instance: https://frog.broadway-academy.co.uk/app/docs/. This document is currently missing documentation for the the "create" endpoint, which I've outlined below: POST to frog.broadway-academy.co.uk/api/fdp/2/datastore/create Provide the following parameters; note these are similar to the "update" params. target_uuid String The uuid against which you wish to associate the data (e.g. for a widget this.options.content_uuid) data String The data you want to store user_uuid String The uuid of the user that this data is associated with (defaults to current user if this param is not passed) alias String The alias for this data, this can be anything you want, and is to help you differentiate the data. For example: 'student.locker_number, student.random_data' max (255 chars)
  4. Thanks for that. I've had a look. Though there's no difference in the way each image is loaded, you may be seeing a difference in speed as some of the images are being loaded from other servers. Images loaded from Frog itself are usually subject to permissions checks as we want to make sure only the people who can view your site can view the images. This check doesn't take long but it's there. On the other hand, images loaded from other servers may take more time to download to your location. Or less! It's not an exact science. The HTML widget was originally intended for when you want to achieve something you can't do with other widgets; it's more powerful but is also more difficult for everyone to understand and update. Any speed differences you see will be dwarfed by random changes in your connection speed.
  5. "creates the image using code" has me curious. Could you post a link to the site?
  6. Code review time! Since you're using the child id a lot, it might be helpful to pull it into a variable. If you move the sort line out of the if statement you can remove the duplicate line in the other branch, which means you only have to fix it once if anything changes. Arrays have a concat method that can be used to add the contents of an array to the end of another array. This should be faster than pushing the entries one at a time. The overall logic might be clearer in future if you handle the initialisation of this.receipts before trying to add data. Add those together, you get something like the following: var data = JSON.parse(response.response[i].data); var childId = data[0].child; // If we haven't seen any data for this child, initialise their record here if (!(childId in this.receipts)) { this.receipts[childId] = []; } // Add the new records to the end of the old ones this.receipts[childId] = this.receipts[childId].concat(data); // Sort the child's records this.receipts[childId].sort(function(a, b){return b.datetime-a.datetime}); At the moment the code will also sort the receipts for a child every time records for that child are found; it shouldn't be too big a deal here since you're only likely to have one or two records per child. None of the above is essential, just thought you might like some insight as to how we approach things here. ?
  7. No problem. I'll keep this thread open, let me know if you need a hand with anything.
  8. Hi again @pconkie. I've grabbed a copy of your code from Graham to take a look at what you're doing and how it could work with the current restrictions of the data store. In your widget you're storing the read around line 111: record.data.push({parent:currentuser.displayname,envir:environment,datetime:moment().unix()}); In your app you're fetching all the report data and grouping it by user uuid around line 68: this.receipts[response.response[i].user_uuid] = JSON.parse(response.response[i].data); What if you added the child uuid to the payload content: record.data.push({parent:currentuser.displayname,envir:environment,datetime:moment().unix(),child:active_child}); Then you could group by that when you fetch the results: var data = JSON.parse(response.response[i].data); this.receipts[data.child] = data; Would that work?
  9. Hi there! I'm one of Adam's colleagues, I've just been given this datastore problem to look at. You're right that it's a permissions issue; at present, only admin and staff profile types can set the user_uuid to a custom uuid. It's fairly strightforward to make this configurable in groups and policies, so I'll add it to my worklist and let you know when it should be available. As an aside; when you want to give us a copy of the response to look at, take a look at the "Response" tab in development tools "network" section. It's next to the "preview" tab you're currently using, and means we can get the actual text.
×
×
  • Create New...