Jump to content
gbligh

MIS Linked Documents widget

Recommended Posts

I think we are there now:

var data = JSON.parse(response.response[i].data);
if (data[0].child in this.receipts) {
  for (var x = 0; x < data.length; x++) {
    this.receipts[data[0].child].push(data[x]);
  }
  this.receipts[data[0].child].sort(function(a, b){return b.datetime-a.datetime});
} else {
  this.receipts[data[0].child] = data;
  this.receipts[data[0].child].sort(function(a, b){return b.datetime-a.datetime});
}

@Graham Quince please feel free to take the updated widget and app.

@simon brahan thanks for your help!

  • Thanks 1

Share this post


Link to post
Share on other sites
2 minutes ago, pconkie said:

I think we are there now:


var data = JSON.parse(response.response[i].data);
if (data[0].child in this.receipts) {
  for (var x = 0; x < data.length; x++) {
    this.receipts[data[0].child].push(data[x]);
  }
  this.receipts[data[0].child].sort(function(a, b){return b.datetime-a.datetime});
} else {
  this.receipts[data[0].child] = data;
  this.receipts[data[0].child].sort(function(a, b){return b.datetime-a.datetime});
}

@Graham Quince please feel free to take the updated widget and app.

@simon brahan thanks for your help!

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

  • Thanks 2

Share this post


Link to post
Share on other sites
On 04/07/2019 at 15:50, simon brahan said:

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

I should go on holiday more often 😛 

I quickly scanned the thread, so I am kinda up to speed - the issue was that you were trying to save something to the datastore that was using the uuid of a child for one of the parents - and it wouldn't let you, correct? In that case, I will speak to @simon brahan about this, because we do have helpers that allow us to easily check if a parent has permission to see data related to a child (e.g. they need parental responsibility over that child etc).

I'm pretty sure that the helper also checks the court order flags from your MIS systems as well. It may be worth investigating how easy it would be to alter the FDP endpoint to do this check on a passed user. I suspect it would be trivial.

Something to think about at least.

  • Like 1

Share this post


Link to post
Share on other sites

Thank you for the new coded widget, its exactly what parents were asking for, I love it. 

We use frog to send our children their GCSE results as we are unable to email them and as we are international, its difficult for students to come and collect them. Its worth noting that students are unable to see any of the documents using the new widget and so have had to switch back to the frog one for student viewing. 

Share this post


Link to post
Share on other sites
12 minutes ago, pdurber said:

Please can I have a copy of this App/Widget.

😀

Hi @pdurber, if you refresh your Frog now, you will find a new Reader application and a Linked Documents widget.

Share this post


Link to post
Share on other sites

HI @Graham Quince Is there any chance this widget (the linked documents widget and the read reciepts widget) could be installed on our Frog server for me to have a play around with over here?

Share this post


Link to post
Share on other sites
5 hours ago, TFox1981 said:

HI @Graham Quince Is there any chance this widget (the linked documents widget and the read reciepts widget) could be installed on our Frog server for me to have a play around with over here?

Hi @TFox1981, they are installed for you now.   Sorry for the wait

Share this post


Link to post
Share on other sites

We've used this widget with our first push out of documents to Parents using frog. It seems to have worked perfectly. However, the read receipts doesn't appear to be picking up when they have been opened.

When we tested it we used parents that work in the school and they can see the reports absolutely fine, but it is not showing that they have read it. What might we be doing wrong?

Share this post


Link to post
Share on other sites
On 21/12/2019 at 07:16, pdurber said:

We've used this widget with our first push out of documents to Parents using frog. It seems to have worked perfectly. However, the read receipts doesn't appear to be picking up when they have been opened.

When we tested it we used parents that work in the school and they can see the reports absolutely fine, but it is not showing that they have read it. What might we be doing wrong?

Ah - was this something to do with a role parents needed?   @pconkie - does that ring a bell?

@adamw ?

Share this post


Link to post
Share on other sites

I’ll check that the Beethoven release didn’t break it. There is no special role that parents need to have.

Share this post


Link to post
Share on other sites

Thank you for giving your time to this.

Just a small question about the reporting widget. in the "Name of the report" field, do I need to put part of the filename that the parents see, or part of the filename that it is called in the Parent Manager?

So if the parents see the name as "Report 19-20 Y10 PC1 for <student name>" and in parent manager it is seen as "49c15f91<student name>-012529-Y10 PC1.pdf" What do I type into the reporting field?

Cheers

Share this post


Link to post
Share on other sites
36 minutes ago, pdurber said:

Thank you for giving your time to this.

Just a small question about the reporting widget. in the "Name of the report" field, do I need to put part of the filename that the parents see, or part of the filename that it is called in the Parent Manager?

So if the parents see the name as "Report 19-20 Y10 PC1 for <student name>" and in parent manager it is seen as "49c15f91<student name>-012529-Y10 PC1.pdf" What do I type into the reporting field?

Cheers

In this case you should use “19-20 Y10 PC1” as the name of the report.

Share this post


Link to post
Share on other sites

So now, shame-facedly I have to say I can now see the read receipts.

I hope you've not spent any time trying to fix something that wasn't actuslly broken - sorry. User Error.

Share this post


Link to post
Share on other sites
6 hours ago, pdurber said:

So now, shame-facedly I have to say I can now see the read receipts.

I hope you've not spent any time trying to fix something that wasn't actuslly broken - sorry. User Error.

Was about to! But thought I’d check back here first..... to be fair it has become quite difficult to follow this thread now and work out exactly why you have to do! Glad it is working.

Share this post


Link to post
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...