New attendance block

New attendance block

by Waleed Jameel -
Number of replies: 79
Hi everybody-

We were asked by a client of ours to customize Moodle 1.5 for them. The client was generous enough to allow us to release their customizations back to the Moodle.org community.

Since the attendance module is no longer maintained, we approached it differently. We wanted to design something that wouldn't require an in-depth integration with Moodle but would be easy enough if required in the long run. A block seemed like the obvious way. =)

PURPOSE
The attendance block is designed to allow instructors of a course keep an attendance log of the students in their courses. The instructor will setup the frequency of his classes (# of days per week & length of course) and the attendance block is ready for use. To take attendance, the instructor clicks on the "Update Attendance" button and is presented with a list of all the students in that course, along with 4 options: Present, Absent, Late & Excused, with a Remarks textbox. Instructors can download the attendance for their course in Excel format or text format.
Only the instructor can update the attendance data in the block. However, a student gets to see his attendance record as a block.

Please note that the email block is still in development. It is not the final release. This release is for testing purposes. It is being released under the terms of the General Public License. Please let me know if you run into any bugs or problems. I would greatly appreciate it.

Lastly, enjoy. Developing this block was a lot of fun for my development team. I hope you enjoy using it too.

-Waleed
The Human Logic Team
Average of ratings: Useful (2)
In reply to Waleed Jameel

Re: New attendance block

by Adam Johnston -
THANK YOU THANK YOU!

I have wanted this badly for a while now.

I installed and have started to use it, but I do have an initial problem.  It won't make sessions.  I select different dates and days (sept 5 2005 - sept 30 2005 and mon-fri for example) and then it says "sessions generated successfully".  Then it takes me to the attendance screen where it tells me there are no sessions and that I need to go to the settings make to create some.   Tried with some differetn dates, etc. and it still isn't working.  I believe my host is using php 4.3.9 and mysql 4.0 if I remember right if that has any effect on why this is happening. 

Thanks!
In reply to Adam Johnston

Re: New attendance block

by Adam Johnston -
Ok, you can ignore me.  I checked and when the block installed (which it said it did successfully) it did not install the two tables into my database.  I used the sql file and did it manually and all systems are go now.  Don't know if this was my systems mistake not seeing them or if it installed them somewhere else or what.  Anyways its going now and seems great.

In reply to Adam Johnston

Re: New attendance block

by James Robertson -
What tables did you need to add?  I will be trying this in the next day or so, and will welcome any information on getting around installation problems (v 2005060222).
In reply to Adam Johnston

Re: New attendance block

by Waleed Jameel -
Thanks Adam! I'm glad you like the attendance block.

What version and build of Moodle are you using on your server? I've tried it with several recent builds and the official stable release and it clicks in fine with them. I would like to try and replicate this if possible. Can you possibly delete the block from the Moodle Admin page and re-install it?

Let me know Adam! smile
In reply to Waleed Jameel

Re: New attendance block

by James Robertson -

Thankyou very much!  I can hardly wait to try it (I have a pressing assignment to complete first).  This sounds perfect.  As soon as I can try it I'll let you know what I find.

Thanks again,

Jim.

In reply to Waleed Jameel

Re: New attendance block

by Manel Lopez -

Good work

It's more cool than the old attendance module.

I have one question: What file must i change to show R - Retard instead L- Late?

One observation: In html title appears course name:attendance

And one suggestion: Old moldule allows you to set the number of hours per session. You could have a class monday during two hours an friday, the same course with the same students but during one hour. It's too dificult change/add this?

Best Regards and TY for your work

In reply to Manel Lopez

Re: New attendance block

by Waleed Jameel -
Manel-

Thanks for testing the attendance block =)

Attendance for classes is attendance. Normally, it isn't hourly based, rather is session based. If you have a session on Friday and another one Monday, the student is either there or is not there. Even if the class has, for example, lectures on Monday and labs on Friday, attendance is taken not per hours of session but per session itself.

To change R - Retard you'll need to make changes in the following areas
  1. block_attendance.php in the lang dir
    line 36, 37. change to
    $string['R'] = 'Retard';
    $string['late'] = 'Retard';
  2. index.php in the main folder
    line # 203. change to
    $late = get_attendance($user->id,$course->id,'R');
That should do the trick. Let me know if it works.

Thanks!
In reply to Waleed Jameel

Re: New attendance block

by Manel Lopez -
HiWaleed

TY for your response. It dont works, but I appreciate it.

If you can think another way to change L by R without many efforts let me know, else don't worry. The purpose to change it is simple: in spanish R - Retraso, in english R- Retard, in french R- Retard, en catalan R- Retard, ...

Best Regards
In reply to Manel Lopez

Re: New attendance block

by Waleed Jameel -
Manel-

At the moment, there isn't any quick and simple way to change the language around. We'll be looking into that for future editions of the attendance block hopefully.

Thanks Manel.
In reply to Waleed Jameel

Re: New attendance block

by Robin Turner -
If it's not too tricky, hourly based attendance would be great. For example, I teach five hours a week, split into two two-hour lessons and one one-hour lesson, so I need to record attendance per hour not per day.
In reply to Waleed Jameel

Re: New attendance block

by N Hansen -
Waleed-Are there any other customizations you have made that you plan to release?
In reply to N Hansen

Re: New attendance block

by Waleed Jameel -
Hansen-

We've also released an email block. The cool thing about our email block is that it keeps a track of sent messages and recieved messages. Read up more about it over at the messaging forum.

Apart from this, we're working on an advanced course based search block, that will be able to sift through all activities and resources within a course.

If you have any other ideas or require a customization you haven't seen  yet, I'll be more then glad to sit down and discuss them. The beauty of such customizations is that if 1 person requires it, chances are that others may want that feature too; a customization almost never goes to waste =)

Thanks!

-Waleed
In reply to Waleed Jameel

Re: New attendance block

by venkatesan iyengar -
Thanks for the block. However, I found the following problems.

1. As a teacher I could not setup the session. The teacher could the see the block only after the admin created for each course individually.
2. The teacher does not see any update attendace button or take attendance button in the block and see only Attendance Records link.
3. On clicking the Attendance records it just gave Attendance Record window with following warning:

Warning: Invalid argument supplied for foreach() in /home/puchorg/public_html/course/blocks/attendance/index.php on line 276

However, Take Attendance Update Session Delete Session are not available to teachers or creators and is visible to admin only.


The following options may be useful:
1. Attendance status for each student as a whole session (as percentage of present and absent) or at any particular date on demand.
2. Attedance status for all students any given day

I do not know how easy to incorporate all these things
In reply to venkatesan iyengar

Re: New attendance block

by Adam Johnston -
Ok, big response coming.  I am on 1.5.2+ from early August.  I will delete again and reinstall to try and replicate the issue, but it was the mdl_attendance, and mdl_attendance_sessions tables I needed to add if I remember right (I am at school and the machines here don't have ftp or the ability to add it).  If it happens again I will let you know, otherwise assume its ok and was a blip from my system for some strange reason.

I used it and like it, but once again I am an admin.  I have to add this to each teacher's courses for it to work.  That's a pain.  Can it be modified so any teacher can set this up on their own?  Without that option to leave it in the teachers hand it is difficult from an admin standpoint.

Lastly, I was going to second some statistics options if possible.  Whether its a percentage of on time versus late and absents, or the ability to somehow convert the attendance into a gradebook entry and give them points for being on time it would be nice to have some method to easily see how they are doing numerically.  The other attendance module had this originally before it broke, and it doesn't need to be the same as that.  Just some percentage or scoring for quick reference or use in grading (I would just use the percentage ontime as an assignment I entered myself at the end of the grading period).

Thanks again for the block, and for listening as some of us suggest some features and ask some questions.  Either way, if you fix the teacher vs. admin issue I will love you smile the other stuff's just wishes.

mrjohnston

In reply to Adam Johnston

Re: New attendance block

by Adam Johnston -
Alright I have tested this quite a bit. I am just going to first say it installed fine the second time, all tables present. Next I just want to say the usability issues I had that you MAY want to consider depending on your client. I think they are pretty general though.

First it only allows a bulk attendance add (where I select days of the week between two dates) once. Then you have to add day by day. If a teacher decides to use the course as a year long instead of as a semester, or just adds the dates to play with it, they then have to add the future dates one by one for the rest of the year. If possible you should have both the bulk and single session add displayed at all times when settings is clicked. Just have separate submit buttons so each person can add sessions however is convenient regardless of its the first or 8th time they are adding sessions.

A delete all sessions button would be nice too if someone screws up, that way they can easily start over from scratch. Maybe just at the bottom of the attendance tab (the one you get to by first clicking settings).

I think this is really minor but I would either display last names then first names, or have it put last names first when you sort by last name. Every roster I have seen is last name, first name. I do not know if you client has it this way, but if they do it would be helpful for them likely to see it the same way their roster shows it.

My other issues still stand as well. Teachers should be able to create sessions and manage them instead of just admins. Also teachers should have a stats tab under settings that basically shows a percentage like the scripts shows to students. Ideally teachers could select how many tardies and excused absences make an absent, say anywhere from 0 (do not count as absences at all) through 5 where each tardy or excused would be one-fifth of an absence). That way the script could be adjustable by the teacher to suit their needs and make sure it shows an accurate percentage to the teacher and students of their attendance. Even without the adjustability it would be highly beneficial to at least display the current percentages for each students on-time is a stats tab as I stated before teachers can then use this to determine an attendance grade, as well as it being an easy way to see each students attendance in general thourhgout the semester or year.

Sorry to put so much stuff down, but you said it was under develepment so I figured I would test it out and try to give some input while I can from a teachers and admins perspective smile
Thanks for the block and I hope something I said helps you and your client make the script fit the needs of students and teachers using it.

mrjohnston
In reply to Adam Johnston

Re: New attendance block

by dorella dore -

 I need "the ability to somehow convert the attendance into a gradebook entry" too.

Now we are using the "assignement" module: the assignement is "to be present" and we give points for that.

It works but we need somthing easier to use: another type of assignement?

that works like this block... I'm just thinking if it is feasible.

In reply to Adam Johnston

Re: New attendance block

by dorella dore -

 I need "the ability to somehow convert the attendance into a gradebook entry" too.

Now we are using the "assignement" module: the assignement is "to be present" and we give points for that.

It works but we need somthing easier to use: another type of assignement?

that works like this block... I'm just thinking if it is feasible.

In reply to dorella dore

Re: New attendance block

by James Robertson -

Off-topic I realize, but does anyone know what causes double entries of forum posts like this?  I have seen it a few times on my site also.

Thanks, Jim.

In reply to James Robertson

Re: New attendance block

by dorella dore -

Why off-topic? (maybe just a little, I was thinking about the easiest solution)

We can use the assignment module to keep (and rate) the attendance. (I’m now using it in this way) But the assignment tool is too complex for the purpose.

A good solution would be to use this block and then to be able to choose to rate attendance or not like it happens for the forum posts.

To obtain this, some work is needed on the grade book too.

Is someone else interested? Am I the only one with this problem?

In reply to dorella dore

Re: New attendance block

by James Robertson -
I meant that my question is off-topic: what causes occasional duplication of forum posts (such as your Sept 23 post)?
In reply to Waleed Jameel

Re: New attendance block

by W Page -
Hi Waleed!

Do you have a working demo of the block available? smile

WP1
In reply to W Page

Re: New attendance block

by Julian Ridden -

A Demo has been placed online in the Playpen. You can loging as a teacher using

name: teacher
pass: teacher

to see the full functionality

In reply to Julian Ridden

Re: New attendance block

by venkatesan iyengar -
Thanks julian

I think you are the admin for that course. Still teachers cannot create their own attendance schedule and post attendance. It is difficult for admin to create attendance for each course and post attendance for each of them.

Your site theme is excellant. Is it possible to send me the copy of that?

Thankyou
In reply to venkatesan iyengar

Re: New attendance block

by Julian Ridden -

Would love to, but not sure how it will work on other sites as I have made many personal changes to it. It is also now a 1.6 site.

While mine has been changed, it did start off as the Kubrick theme. Search for that in the theme forums and you will be well on your way.

JR

In reply to Julian Ridden

Re: New attendance block

by MC Otake -
Julian,
Congratulations! I've visited your site and it's AWESOME! I wish I could have just a fraction of your ability and knowledge.
In reply to MC Otake

Re: New attendance block

by Julian Ridden -

Thankyou for the compliment. It should be noted that my PHP coding expereince is mimal. The site looks as good as it does due to the work by developers in this community developing new functions that I then installed.

All I have really done is developed the look and feel of the site through theming.

In reply to Julian Ridden

Re: New attendance block

by Waleed Jameel -
Julian-

Thanks for the demo site =) Your Kubrick theme looks great. How did you get the different icons for the admin, instructors, students?
In reply to Waleed Jameel

Re: New attendance block

by Julian Ridden -

Its just a simple little trick really. The homepage of moodle is just a course. So each member of the site is a participant in that homepage "course" by default.

All I did was create three groups and add an image to each group corresponding with the role. As members joined the site they were made part of the student group by default. Teachers were thenj moved to the teachers group and I joined the admin group.

Hope that makes sense.

In reply to Waleed Jameel

Re: New attendance block

by Chris Patch -

Hi Waleed,

Thanks for the nice block! i have been looking for something like this for a long time.

I modified it into a homework block for offline checking homework if anyone wants it [attached file], it's pretty much the same thing but will install as a new block and can be used for homework checking (done, incomplete, not done, excused).

I do have the problem that everyone else is having with a twist though:

All my teachers can't do anything with it. It's like they are recognized as students without a student id so they don't show up in the block but will see it as a student will. BUT one of my teacher's can use it fine. He doesn't have any more rights to anything that the other's don't. I looked through the SQL tables and everything matches for all teachers. It's driving my up the wall trying to figure it out. If you can help that would be much appreciated. I am working on a Korean translation for both and will post the file here when it's done.

Thanks again,

Chris Patch

In reply to Chris Patch

Re: New attendance block

by Chris Patch -
ps: you also entered student as studnet somewhere, i think it was related to having the student id's displayed when you exported to excel.smile
In reply to Chris Patch

Re: New attendance block

by Chris Patch -

The problem appears to be in the line 276 in index.php and 124 in updatehomework.php (though the latter only happens if you enroll an admin in a class as a student and try to take attendance as the teacher):

foreach($students as $key=>$student)

In reply to Chris Patch

Re: New attendance block

by Adam Johnston -
I have the same problem where I setup the block and it doesn't work for the teachers at all.  Only when I look at it as admin.  Must be missing somethign to define who is/are teachers vs. students so it only recognizes admins.  Don't know that I'll be good at figuring out what it is, but I try.
In reply to Waleed Jameel

Re: New attendance block

by Lady 800cc -

Any new release? Or do you keep an updated version of the file on Playpen?

In reply to Waleed Jameel

Re: New attendance block

by Lady 800cc -

*** STANDING UP AND APPLAUDING WILDLY!!! ***

THIS IS AWSOME!!!  It's all I wanted. A way of recording attendence online for a course that meets in person, but uses the features of moodle to enhance learning.

Thank you so much.  If there is anything I have to fix... I'll just fix it or work around it, but this is far better than nothing!!! big grin

In reply to Waleed Jameel

Re: New attendance block

by Lady 800cc -

I think I've found a fix to the problem of 'teachers' being defaulted to 'student'. It's seems to be working for me. Everywhere in the code for all of the files that use it:

Change: if (isteacher($USER->id))

To: if (isteacher())

Now everything is working perfect except that the block should not display at all for guests. It's a minor issue in that the links for a student show, but when logged in as guest, if you click the links there will be no data because there is no 'studentID'.  Otherwise, with the above changes, the teacher can use the attendence block.

Average of ratings: Useful (1)
In reply to Lady 800cc

Re: New attendance block

by Chris Patch -

Thanks! That cleared the problem right up.

Here is a copy of the attendance block with the changes Lady 800cc suggested and the references to 'studnet' changed to 'student' and 'Thanq' to 'Thank'.

In reply to Chris Patch

Re: New attendance block

by venkatesan iyengar -
Now the teacher can take the attendance and thanks for your great effort and I'm and trying to test it for our courses. However, I do not see all the students. I have 33 students in my class, but I see only 13 students. How to enable all the students, may be 10 in each page?

thankyou
In reply to venkatesan iyengar

Re: New attendance block

by Chris Patch -

Interesting, I tried throwing 118 students into a class to see if it would do the same thing, works fine for me, shows them all on one page as well.

In reply to Chris Patch

Re: New attendance block

by venkatesan iyengar -
I could see all the enrolled students in the attendance block only after I manually enrolled students in to the course (eventhough all the students have already enrolled through automatic email).

1. This means that students enrolled through automatic email are not visible in the attendance block and each teacher has to manually enrol the student from the teacher admin.This is an additional job to the teacher.

2. Also I see all the days of the semester in the attendance tab. Since, my course is scheduled only for four days (Mon, Tue, Thu, Fri) in a week, I need not see all the days in the semester in the take attendance page. It is too difficult for me to match the date and day in the attendance page for whole semester and delete the sessions one by one. It is better that the setting page may have additional details to fix the days in week and only the specified dates are visible in the attendance page.
I understand the present format is done intentionally to enable the teacher to adjust the missed lecture day and compensate on some other day. In that case the day may also be made visible so that teacher can select and delete the unwanted sessions.
In reply to venkatesan iyengar

Re: New attendance block

by Lady 800cc -

"...This means that students enrolled through automatic email are not visible in the attendance block and each teacher has to manually enrol the student from the teacher admin..."

This doesn't sound like an attendence block problem, but more like an enrollment problem.  I read in the General problems about students being automatically unenrolled from a course when the "Enrollment Duration" variable is set to a finite amount of time less than the duration of the course. Apparently this variable should be interpreted as the amount of time students should remain enrolled in the course. [It is a bad application of the variable]

In reply to Lady 800cc

Re: New attendance block

by venkatesan iyengar -
I understand enrollment duration must have deadline and not the full duration of the course. How to solve this problem? Sorry I'm probably asking in a wrong place.

What about my other problems in attendance block on session visibility?
Now I found that teacher cannot delete a session and it gives

Authentication Denied

error. However, admin could do the same.
In reply to venkatesan iyengar

Re: New attendance block

by Lady 800cc -

Chris missed changing the code in the 'deleteSession.php' file on line 23 of the code.  Just fix as instructed in my previous entry above.

You should be ok then.

In reply to venkatesan iyengar

Re: New attendance block

by Lady 800cc -

"...What about my other problems in attendance block on session visibility?..."

Hi Venkatesan,

Your questions are getting me too deep into this. I LOVE IT! smile

Anyhoo, in the index.php file on line# 97 in the query statement,

Change:

date_format(sessdate,'%d - %b - %Y')

To:

date_format(sessdate,'%W: %m-%d-%Y')

Your session date will appear as: Friday:  09-16-2005

"...I understand enrollment duration must have deadline and not the full duration of the course. How to solve this problem? Sorry I'm probably asking in a wrong place..."

Bottom line, you should set your enrollment duration to "unlimited" to avoid any chance of students being automatically un-enrolled.

Good Luck,

Lady800cc

In reply to venkatesan iyengar

Re: New attendance block

by Lady 800cc -
I just realized in order for the student to see the same date format, you must make the change to line# 263 also.  Here is the index.php file with the changes.
In reply to Waleed Jameel

Re: New attendance block

by Lady 800cc -

Here is an updated Zip file of the attendence block.

README.txt was also updated.

Lady800cc

In reply to Lady 800cc

Re: New attendance block

by venkatesan iyengar -
Thanks for the prompt update. I'll look into that.
Regarding enrollment period, I do not agree that the course should have unlimited enrollment (with automatic email enrollment enabled). This will make unwanted people to simply enrol themselves at any time in any course and could even choke the server bandwidth. Even though I'm not a very good php programmer I do not think it is difficult to look in to student list of a particular course and populate atttendance block.

I think this seems to quite stable (as heard from other teachers in my department) and probably can be put to moodle download page and CVS.

Thanks again for the update
In reply to venkatesan iyengar

Re: New attendance block

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
This is in cvs:/contrib/block_attendance for now. Waleed, if you want CVS access please get in touch with me (and tell me your sourceforge userrname)
In reply to Martin Dougiamas

Re: New attendance block

by Waleed Jameel -
Great! Thanks Martin.
I'm glad that we were able to develop something that contributes to the big Moodle picture.

What is the best way to get in touch with you? IM? Email? Skype?

Do let me know. Thanks once again.
In reply to Lady 800cc

Re: New attendance block

by Miroslav Fikar -
I have tried to install the newest attendance.zip but it still gives me the following errors:

  1. file version.php is missing. So I have copied the file from assignment.
  2. there is something wrong with lib.php. Installation using moodle/admin shows content of the file starting as (line 34): shortname $module"); header("Content-Disposition: attachment; filename=\"$downloadfilename.xls\""); header("Expires: 0"); and continues until the end of file.
  3. the same message is then printed in all moodle pages

I use moodle 1.5.2. Any ideas?
Miroslav Fikar
Average of ratings: Useful (1)
In reply to Miroslav Fikar

Re: New attendance block

by Miroslav Fikar -
OK, finally I can reply to myself.
Almost all my problems have been caused by the fact that I installed attendance as a mod and not as a block (my fault!). When installed correctly, it began to work.

Now, there are/were still some issues:
  • several files use <? instead of <?php. There are some sites (ours, for example) where it causes problems and the block does not work,
  • if a student of the course is in some other course defined as teacher, then he/she has teacher rights in attendance too,
  • several places show some string title - for example when clicked on "Take Attendance" - attendance, or "Settings" - newsession in the title of the tab.
But anyway, it seems to solve our needs for attendance. Thanks.
M. Fikar

Average of ratings: Useful (1)
In reply to Miroslav Fikar

Re: New attendance block

by Waleed Jameel -
M. Fikar-

I'm glad you were able to figure out the cause of the problem. I had my team look at your message and we were unable to replicate on any of our Moodle installations! smile Guess we didn't try installing it as a mod (I wasn't aware that Moodle would even do that but I guess it will!).

I'll have my team look at the concerns that you've posted. I can answer you on one though. If a student is made a teacher, then they too, yes, automatically get rights to attendance. They also get the ability to play around with the entire course settings because they're the teacher. Am I correct on this? Please let me know.

Finally, I'm glad that this solves your attendance needs =) It's great to see how many people are having a great success out of using the attendance block.

-Waleed
In reply to Waleed Jameel

Re: New attendance block

by Miroslav Fikar -
Waleed wrote --->
I can answer you on one though. If a student is made a teacher, then they too, yes, automatically get rights to attendance. They also get the ability to play around with the entire course settings because they're the teacher. Am I correct on this? <--- Waleed wrote

No, I mean a person who is a teacher in some Course B has registered himself as a student in the Course A that has attendance block turned on. So his role in A is pure student, but somehow he has teacher's abilities for attendance in A (he can change attendances for all students, etc) - but not for any other activity in A, of course.

M. Fikar
Average of ratings: Useful (1)
In reply to Lady 800cc

Re: New attendance block

by venkatesan iyengar -
I have another requirement. Exporting to Excel or text file works only for the current day and not any other day. is possible to incorporate the following modifications:

1. Attendance report on any one selected day
2. Weekly report
3. Monthly report
4. Consolidated report on end of the course

I thank Martin for including in to CVS
In reply to Lady 800cc

Re: New attendance block

by Waleed Jameel -
Folks-

The response to the attendance block has been marvelous! First off, thank you everybody for being participants in this release. Without you, none of this would have been possible. I appreciate the time and effort all of you have put into this.

The error that was coming up (instructors unable to use the block, etc) was actually fixed by my team last week. However, we were unable to post the updated attendance block due to some technical difficulties. By the time we resolved our issues and looked up at moodle.org, I was very pleasantly surprised; the ingenious community of Moodle.org had taken the bug into its own hands and fixed it too, locating the exact place where the problem was occurring. Thanks to Lady800cc who took the time to answer some queries and provide solutions (all that documenting the code finally paid off, eh?).

There are a lot of recommendations and feedbacks on the page here which I appreciate. Im going to take the next day or two to read over and write up responses to the peoples questions and see which direction our team is headed to with the attendance block.

Ill post up a new release of the attendance block later on today/tomorrow in a new message to the forum, with responses to you folks.

Thank you.

-Waleed

PS: Lady800cc, could you please get in touch with me directly? Thanks!

In reply to Waleed Jameel

Re: Problem with excused absences

by Tim Allen -

Hi Waleed,

As others have stated, I really appreciate this attendance block, which is just great!  smile

I have one little problem with the block, which I would like to tell you and others about, to see whether anyone can help fix it.

When I mark an absent student as excused (for illness for example) this session should be excluded from the percentage attendance, but this is not happening.  You can see an example from the screenshot below.  The student has not been absent at all, and has been excused once in 6 lessons, so the attendance should be 5/5 = 100 %, but instead it is 5/6 = 83%! 

I'm sure that fixing this would be a fairly simple change to one line (touch wood!) but I'm hopeless at PHP and wonder if anyone could give me a pointer as to which line I need to change to fix this faulty arithmetic.

Thanks in advance! smile

Tim.

Attachment attendblckprob.jpg
In reply to Tim Allen

Re: Problem with excused absences

by Lady 800cc -

Hmmmmm.  It is easy to change; but is that the way all teachers calculate excused absences?

Is it fair to grade two students the same if one makes an effort to schedule a doctors appt. during non-school hours and the other does not?  It would seem that we may need to code a choice in the block settings that define how excused abesences should be calculated based on the teachers preferences. mixed

Lady800cc

In reply to Lady 800cc

Re: Problem with excused absences

by Tim Allen -

Hmmmmm - I'm think you missed the point.  smile

There is a valid question as to whether a student who was excused for one lesson out of  four (for example) should have their attendance calculated as 3/3 = 100% or 4/4 = 100%.  I think the first is more logical, but others may have different opinions on that.

The second issue is whether the "Attendance percent" is intended to be a mere count of how many times the students has attended classes,  or whether it is some kind of qualitative score of their attendance.  I suppose there could be a preference setting for this but IMHO for most people a percentage (especially in this context) implies a kind of assessment and therefore if that is not what was intended it should be changed (because it is misleading).  If the intention is to merely  document how many times the student has attended then a simple total would suffice (which is in fact already there as "Number of days present").

IMHO nothing needs to be coded into Moodle regarding what an "excused absence" ("E" in the attendance block) is - that can just be left up to the judgement of individual teachers.  I just gave one example, but what if a student fell sick and was rushed to hospital, would it be fair to penalize the student in that case? wink  There are many different scenarios, and from the Moodle point of view it should be left up to the teacher to decide what he or she wishes to excuse and not to excuse.

If a teacher wishes to never excuse anyone, then they would never mark a student as "E" and therefore the problem would never arise.  But if there is even just one occasion on which a teacher would excuse a student, then it would surely be wrong to penalize them vis-a-vis another student - because that is what "excused" means!  wink  Otherwise there would be no need to even make a distinction between "Excused" and "Absent".

Anyway, this is just my opinion - what do others think?

Tim.

PS Let me re-iterate to Waleed - this is a fantastic block!  Thank you once again.  approve

In reply to Tim Allen

Re: Problem with excused absences

by Tim Allen -

OK, I got brave and took the plunge and think I found a solution:

In the file index.php, change line 295 from this:

 $percent = number_format( (100 * ($present + $late) /($complete)),2) . ' %';

To this:

$percent = number_format( (100 * ($present + $late) /($complete-$excused)),2) . ' %';

It might not bet the best hack (make a new variable?), but it works for me.

Hope this helps anyone else,  smile
Tim.

In reply to Tim Allen

Re: Problem with excused absences

by Chris Patch -

Thanx for the help Tim, I was having that problem too.

I added a few changes after I saw what you did: $percent = number_format( (100 * ($present + $late) / ($present + $late + $excused + $late) + $excused)),2) . ' %';

Why:

If a student joins in mid-term it will calculate his attendance based on the total sessions marked, rather than just the classes he has taken.  eg. If there were 20 classes and a student joins in for the last 5, he will only be able to get a total of 25%.

There is also no way of marking him excused for any days before he was enrolled without editing the database. This will total up all sessions he has been enrolled in the class for and give a correct percentage.

ps. there is also a mod attached that takes homework information as well, I found that the two look work good together. It's only the same one with a few changes made to it.

In reply to Chris Patch

Re: Problem with excused absences

by Tim Allen -
Hi Chris,

Thanks a lot for this, it loooks very helpful. smile

 I just want to check your formula to make sure it is right:

$percent = number_format( (100 * ($present + $late) / ($present + $late + $excused + $late) + $excused)),2) . ' %';

Should that be:

$percent = number_format( (100 * ($present + $late) / ($present + $late + $excused) - $excused)),2) . ' %'; ?

Tim.

In reply to Tim Allen

Re: Problem with excused absences

by Dmitry Pupinin -
Picture of Core developers Picture of Plugin developers
$percent = number_format( (100 * ($present + $late) / ($present + $late + $excused) - $excused)),2) . ' %';

Please, check brackets! wink

And one question:
Do you extract days from percents? What this means?
In reply to Dmitry Pupinin

Re: Problem with excused absences

by Tim Allen -
I think I meant this:

$percent = number_format( (100 * ($present + $late) / ($present + $late + $excused + $absent - $excused)),2) . ' %';

which could just be written like this:

$percent = number_format( (100 * ($present + $late) / ($present + $late + $absent) ),2) . ' %';

I hope my mathematically challenged brain has got that right! shy  (By the way, I just copied that from Chris and never checked the brackets as I was focusing on other things).

Do you extract days from percents? What this means?

It is subtracting days from days - the idea was to subtract the number of excused classes from the total number of classes for a particular learner BEFORE converting it to a percentage.

Tim.
In reply to Tim Allen

Re: Problem with excused absences

by Somaroy Gabbita -

Dear TIM ,

             Thats was nice from you that you digged into the code so deep . but that piece of code is deprecated long time back . the latest attendance block now in the CVS has a lot more enhancements to it. So with the new block you have settings in the configuration > blocks against attendance where you set each field like "present" "absent" "excused" "Tardy" or whatever needed and what exactly that particular field should do in calculation + or - . so please take this and test it and you'll enjoy the new feqatures more .

Somaroy Gabbita

Lead Developer

Human Logic

Dubai. 

In reply to Somaroy Gabbita

Re: Problem with excused absences

by Miroslav Fikar -
Dear Somaroy,
there are fairly many problems in this version you have posted. To mention just a few:

Administration : Configuration : Blocks : Attendance
Warning: Invalid argument supplied for foreach() in C:\www\www\moodle\blocks\attendance\config_global.html on line 43

Take attendance:
Parse error: parse error, unexpected $end in C:\www\www\moodle\blocks\attendance\takeattendance.php on line 162

Attendance : Update
Warning: Invalid argument supplied for foreach() in C:\www\www\moodle\blocks\attendance\lib.php on line 165
  Status :
  -
  -
  -
  -

Still, the block cannot handle groups and is thus confined to only small courses.

Best,
Miroslav Fikar
In reply to Somaroy Gabbita

Re: Problem with excused absences

by Chris Patch -
Hello Somaroy,

I installed your new version of the attendance block and went to the block settings and got this message:

Warning: Invalid argument supplied for foreach() in /www/studycea/blocks/attendance/config_global.html on line 43

Cheers,

Chris

In reply to Chris Patch

Re: Problem with excused absences

by Chris Patch -

Hello Somaroy,

I think I found the problem (I'm not an expert), if you upgrade the module it does not upgrade the database and add the new setting field. I think it's bacause the version numbers on the old one and the new one match. If I add the field manualy I can get by the options working. But, none of the attendance entries that were previously entered will show up (they work again when I downgraded it back to the old one).

Question about the new options in the config options: I use a multi language site, my teachers and the student's parents don't speak the same language. I made a korean language translation so when the parents log on the can see it in korean. But with the new options, don't I have to pick one language?

Thanks a lot for the block by the way, it was exactly what I needed for the school and overall it works great.

Chris

ps. I'll post the translation here if anyone is interested in having a korean version (don't know if you made your own Tim). Only the few strings that the students can see are done, but I can finish it off if there is a need for it.

In reply to Somaroy Gabbita

Re: Problem with excused absences

by Dmitry Pupinin -
Picture of Core developers Picture of Plugin developers

the latest attendance block now in the CVS has a lot more enhancements to it.

I don't see LASTEST version of module in CVS! There no config_global.html and new table in database! There are old version.

Please, check it!

In reply to Somaroy Gabbita

Re: Problem with excused absences

by Tim Allen -
Hi Somaroy,

Just to inform you that this version seems to be newer than the one in CVS.   smile

Tim.
In reply to Tim Allen

Re: Problem with excused absences

by Chris Patch -

Yikes, sorry about that.surprise Actually what I had was this:

$percent = number_format( (100 * ($present + $late) / (($present + $absent + $excused + $late) - $excused))),2) . ' %';

Which now Tim pointed out is obvously the same as:

$percent = number_format( (100 * ($present + $late) / ($present + $absent + $late) ),2) . ' %';

I had just replaced "sessions" in Tim's first formula with with "P+A+L+E" to get total attended sessions, sorry folks.

PS. I finished an online spelling course recently that I think shows a good use of the activity locking and other good moodle features. You can see it HERE if you are want to take a look. Log in as: moodleuser pw: moodleuser. (most of the flash will only work in IE, it will look pretty barren in firefox. If you know why, I'm all ears)

In reply to Tim Allen

Re: Problem with excused absences

by Waleed Jameel -
Tim-

Thanks for letting me know about the excused students attendance calculation. I'll talk to my team tomorrow and see what its all about.

As for how one calculates attendace, we took a basic approach to it. If they're not in class, then it's a count against them. The attendance block was to note how many times a student was in class, and if wasn't in class, then the official reason presented to the students. That's how our client wanted it done.

At the same time, I understand what you're saying Tim.
If a student is excused, then they are excused with a reason from their attendance being counted towards the final grade. However, if they missed class without an excuse, then it is an absent count against them.

How a teacher handles excused absences and unexcused unabsences is their choice. We can make a note of this recommendation for future updates of the attendance block. Thanks for that. Only with your feedback is that possible.

=) Hope that helps Tim. I'll post an update on the excused attendance situation tomorrow.

-Waleed

PS: Glad you like/love the attendance block =)
In reply to Waleed Jameel

Re: Problem with excused absences

by Bhupinder Singh -

Hi Waleed,

Your block is great.

I am having a little problem. Can you help me figure out how to correct the problem and where I am going wrong.

After the installation I am getting the following error.

Warning: file(c:\program files\easyphp1-7\www\moodle/blocks/block_attendance/block_block_attendance.php): failed to open stream: No such file or directory in c:\program files\easyphp1-7\www\moodle\lib\blocklib.php on line 21

Shall greatly appreciate your help.

Garry

In reply to Bhupinder Singh

Re: Problem with excused absences

by Adam Johnston -
Well the obvious signs of an issue to me are your slashes reverse after www which may or may not be an issue, and your final script file is looking for block_block_ which strikes me as an issue.
Hopefully that helps. 
In reply to Adam Johnston

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Waleed Jameel

Re: New attendance block

by Lady 800cc -

Hi all,

I've been working on the date to be displayed in the same format [ie Tuesday: 10-04-2005] in the automatic news forum post, for the before and after session date; and I have a fix for that. * when you change the session date, a post gets sent to the news forum; the new session date was formated the old way *

I'm also working on a "screen display" for the teacher to see, all students attendence, at a glance, before having to download a cvs/excel file.

Waleed, if your team is already working this, I will leave alone smile

Lady800cc

In reply to Waleed Jameel

Re: New attendance block

by Miroslav Fikar -
I have another requirement/wish for the block.

Would it be possible to implement group mode too?
We have some fairly large classes with more than 100 students that are divided into smaller groups - also in Moodle course. When a teacher wants to fill the attendance for his group, it is now fairly difficult to find the appropriate students in the whole class. Other activities have a list box, where the name of the group can be displayed and the corresponding information is filtered.

Miro
Average of ratings: Useful (1)
In reply to Miroslav Fikar

Re: New attendance block

by Julian Ridden -
I would love to second this. We use moodle in a school and seperate our classes using groups. Having groups added to the functionalty would make this a perfect solution for us.
In reply to Waleed Jameel

Re: New attendance block

by Miroslav Fikar -
I was playing with the attendance module a little more and it seems that backup/restore feature is not fully implemented. The block attendance gets restored but its contents does not. So, always save excel/csv file separately when doing backup of the course.
Miro
Average of ratings: Useful (1)
In reply to Waleed Jameel

Re: New attendance block

by Maurice Jacque -
I wish someone can help me install this block. I have the zip file ... i extracted it to the blocks folder. What am i to do next?