Skip to main content
OpenEduCat logo
Configurable Direction

Moodle Attendance Sync

Attendance records from Moodle's Attendance plugin map to OEC's attendance registers and session lines. Unlike grade sync (pull-only) or course sync (push-only), attendance direction is configurable: pull from Moodle, push from OEC, or run bidirectionally.

The sync requires the local_wsattendance Moodle plugin, which exposes the attendance WS API. The integration detects its presence at runtime and gracefully skips attendance sync if the plugin is not installed.

Attendance Status Mapping

Moodle uses single-character acronyms. OEC uses four boolean fields. The mapping is fixed.

P

Present

Moodle acronym: P

present=True

All other booleans → False

A

Absent

Moodle acronym: A

absent=True

All other booleans → False

L

Late

Moodle acronym: L

late=True

All other booleans → False

E

Excused

Moodle acronym: E

excused=True

All other booleans → False

Custom Moodle status acronyms beyond P, A, L, E are skipped by the integration.

Sync Direction Options

Set sync_attendance_from on the Moodle Instance record in Odoo.

moodle

Pull from Moodle (default)

Moodle Attendance plugin is the source of truth. OEC attendance registers are populated from Moodle sessions.

Best for

Online-first institutions where all sessions are tracked in Moodle.

oec

Push from OEC

OEC is the source of truth. Attendance marked in OEC is pushed to Moodle via mod_wsattendance_update_user_status.

Best for

Institutions that use OEC for in-person attendance and want Moodle to reflect it.

both

Bidirectional (last-write wins)

Both systems can record attendance. The most recent write wins. Conflicts are not flagged, the last timestamp takes precedence.

Best for

Hybrid institutions with both in-person (OEC) and online (Moodle) sessions.

Prerequisites

Attendance sync requires additional setup beyond the base Moodle integration.

RequirementWhere to installNotes
Moodle mod_attendance pluginMoodle plugin directoryCore attendance plugin. Provides the session and attendance status data structures.
local_wsattendance pluginMoodle plugin directory (additional install)Exposes mod_wsattendance_get_session and mod_wsattendance_update_user_status WS functions. Required for any API access to attendance data.
openeducat_attendance moduleOEC module listThe OEC attendance module must be installed. Provides op.attendance.register, op.attendance.sheet, op.attendance.line models.
WS function enabled on external serviceMoodle → Site Administration → Web services → External servicesAdd mod_wsattendance_get_session (and mod_wsattendance_update_user_status for push direction) to the openeducat_integration service.

OEC Attendance Data Structure

Moodle attendance sessions map to a three-level hierarchy in OEC.

op.attendance.register

One per session date + subject

Created or found by the sync service. Note: this model does NOT have a faculty_id field. Faculty is on op.attendance.sheet, not the register.

op.attendance.sheet

Groups students for a register

Created per batch within a register. The faculty_id field lives here, but the sync service does not set it, there is no reliable mapping from a Moodle session to an OEC faculty member.

op.attendance.line

One row per student per session

The four boolean fields (present, absent, late, excused) are set from the Moodle status acronym mapping. Lines are idempotent, existing lines are updated on subsequent syncs.

Runtime prerequisite check

The SyncAttendance._check_prerequisites() method runs before every sync. It calls module_detector.detect_installed_modules() to verify both mod_attendance and local_wsattendance are present in Moodle. If either is missing, attendance sync is skipped gracefully, it does not raise an error or block other sync services.

Attendance Sync, Frequently Asked Questions

How Moodle attendance sessions map to OEC attendance records.

The standard Moodle Attendance plugin (mod_attendance) combined with the local_wsattendance plugin, which exposes a WS API. The sync service tries mod_wsattendance_get_session first, then falls back to mod_attendance_get_sessions. Both functions come from local_wsattendance; neither is a standard Moodle core function. The local_wsattendance plugin must be installed in Moodle; the integration detects its presence at runtime via detect_installed_modules().

Ready to Transform Your Attendance Sync?

See how OpenEduCat frees up time so every student gets the attention they deserve.

Try it free for 15 days. No credit card required.