In the process of running a Google Sync you may often find yourself faced with an error that Wonde displays from the Google Classroom API which simply states 'Precondition check failed'.
It should be said that Wonde Google Sync will likely never be the cause of such an error to occur, as if we are able to obtain the correct MIS data we will always attempt to provision the membership of the Classroom in exactly the same manner as we always do. In the rare circumstance that the 'Precondition check failed' error does occur, the error is from the Google Classroom API.
Below is a summary of the 5 scenarios that can cause this to occur:-
CourseNotModifiable - This is by far the most common cause that you will come across when using Wonde Google Sync.
CourseNotModifiable indicates that the relevant course is in a state that doesn't allow its properties to be modified (other than the course state itself). The most common cause again, by far, for this state to occur is that the Google Classroom membership has been orphaned by the deletion of a user that is the sole teacher attached to the Google Classroom.
Prompt the user to change the course to a modifiable course state. To change the state, use courses.patch(). The course state can be changed in a request that changes other properties.
Correcting an orphaned Classroom is impossible as no new members can be added to it. Instead, go to google.wonde.com/matching/classes and return the afflicted Classroom (as denoted in the sync log when running the sync at google.wonde.com/directory/sync), to 'Create on sync' and re run the sync to provision the Classroom and it's memberships again.
CourseMemberLimitReached indicates that the attempted action would exceed the maximum allowed number of course members. This code is typically returned by the students.create() For further information, refer to the "Class size limits" section of the Invite students to a class help center article.
Describe the cause of the failure and suggest that the user remove unnecessary course members
CourseTeacherLimitReached indicates that the requested action would exceed the maximum allowed number of course teachers. This code is typically returned by the teachers.create(). For further information, refer to the "Class size limitations" section of the Add a co-teacher to a class help center article.
Describe the cause of the failure and suggest that the user remove unnecessary course teachers. If applicable to your app, you can use teachers.delete() to manage teacher rosters on behalf of the user.
UserGroupsMembershipLimitReached indicates that the user is already a member of the maximum allowed number of groups and can't join any courses. This code is typically returned by students.create() or teachers.create(). For further information, refer to the "Class size limitations" section of the Invite students to a class help center article.
Describe the cause of the failure and suggest that the user leave any courses in which they are not participating. The user may consider creating an additional account if they need to participate in more courses. If applicable to your app, you can use students.create() or teachers.delete() to manage rosters on behalf of the user.
AttachmentNotVisible indicates that one or more attachments specified are either not visible to the user, not of the requested type, or do not exist. For example, Drive items that haven’t been shared to the user would return this error.
Describe the cause of the failure and suggest that the user recheck the identifiers, such as Drive file IDs, they have included. Also, ensure the user has the proper permissions to view the attachment.