Tracking Student Absences

Hello,

Thank you for your hard work on Tinderbox 9; it looks like much thought has gone into its design.

Once again, the missionary impulse has meant that my summer online course is much larger than usual. I’m forced into tracking my students’ attendance. Or at least, I’m thinking about how I might go about doing this effectively.

I’ve managed to find a way to transform a csv file downloaded from Zoom through a lookup list, filter out the students attending a session into a set, and match their zoom handles against the course roster to get a set of “AbsentStudents” that I store in an attribute named “$AbsentStudents” for each class session which has an attribute $ClassDate. So far so good!

What I’m trying to do now (and failing at!) is to then for each of these $AbsentStudents extract the $ClassDate and place it the informational note for each student, such that there is a set entitled $Absences which includes the dates “5/1/2021, 5/2/2021” and so on, listing the sessions for which the student was absent.

My thought was to have a rule like the one below, attached to each student note. N.B. “this” == a note with the $Name “Smith,John” formatted exactly the same as the individual names in the set $AbsentStudents on the note for each class session.

$Absences(this)=collect_if(children("Class Sessions"),$AbsentStudents.find($Name(this))==true,$ClassDate.format("l"));

My problem it seems is that I get a list of all of the dates that any student was absent in every note. So every student appears absent on every day. Perhaps it is a subtle warning for me to try to be a more engaging zoom teacher.

Yours,
Maurice

I think the following test is not what you want:

$AbsentStudents.find($Name(this))==true

I’d begin by checking the value of $AbsentStudents.find($Name(this)) in some representative note. Is it what you expect?

I’d suggest using [List/Set].contains($Name), which is true if the list or set contains the element.

Dear Mark,
Thanks, yes! That’s much closer. Indeed, “hard coding” the student’s name now works as expected.

$Absences=collect_if(children("Class Sessions"),$AbsentStudents.contains("Smith, Jonathan")==true,$ClassDate.format("l"));

However, replacing “Smith, Jonathan” with $Name doesn’t seem to work, and I can’t figure out why? I’m running the action code in the Rule section of the note’s $Name, is there some item designation missing?

$Absences=collect_if(children("Class Sessions"),$AbsentStudents.contains($Name)==true,$ClassDate.format("l"));

Almost there,
Maurice

Aha. Inside a .collect, this is bound to the note that’s being tested. But you want to compare the name to the name of the note that has the rule — $Name(that).

I believe I’m correct in saying find() is not a valid dot operator. Is that true @eastagate? (Otherwise I need to revisit the documentation). This is the list of know dot operators (as at v8.9.2 - v9 adds some but not this).

Also, I believe children("Class Sessions") is not valid syntax as designators cannot use offsets. If you can’t find a designator that coder the items you want, use collect() with a find() in the designator. find is the exception to the rule that designators can’t use parenthetical arguments. In the case of find(), the argument is different from an attributye type offset as it takes a query like you would use in an agent.

[String].find(theString) returns the position of theString in the source string. theString is a literal string, not a regular expression. If theString is not found, returned value is -1. (This is a very obscure corner of Tinderbox; I was ready to say that .find() doesn’t exist before I checked the code.)

children(/path/to/note) looks like a valid designator to me. You can nest designators: for example: $Age(child(nextSibling)) is the age of my nephew.

Re .find() thanks, I’ll document that in case it crops up again.

Designators. Yes, I phrased things poorly. What I was pushing towards was that I recall you telling (can’t find the place) that while designators can nest, you can’t do so using find(), as in children(find(query)) as opposed to nesting such as parent(original). Does that make a better description of the issue?

1 Like

Dear Mark B. and Mark A.
Thanks so much for your help. Mark B. using “that” correctly solved the problem.
Thanks Mark A. for the further clarifications.
Yours,
Maurice

1 Like

I’m working on aTbRef9 at the moment and will try to clarify the use of offset references in designators.