- function (doc, meta) {
- var varSync = doc._sync;
- var varDeleted = doc._deleted;
- var varKey;
- var varValue;
- /*
- We do not want the view to fetch sync specific documents that are stored in the bucket.
- The below if condition will ignore those documents
- */
- if (varSync === undefined || meta.id.substring(0,6) == "_sync:")
- return;
- /*
- We do not want the view to fetch deleted documents that are stored in the bucket.
- The below if condition will ignore deleted documents
- */
- if (varDeleted)
- return;
- varKey = [
- doc.activityId,
- doc.stateId,
- doc.agent,
- doc.agentMbox,
- doc.agentName,
- doc.agentOpenId,
- doc.agentAccountName,
- doc.agentAccountHomePage,
- doc.agentMbox_sha1sum,
- doc.registration,
- doc.documentName,
- doc.className
- ];
- varValue = {
- id: meta.id,
- rev: varSync.rev,
- activityId: doc.activityId,
- stateId: doc.stateId,
- agent: doc.agent,
- agentMbox: doc.agentMbox,
- agentName: doc.agentName,
- agentOpenId: doc.agentOpenId,
- agentAccountName: doc.agentAccountName,
- agentAccountHomePage: doc.agentAccountHomePage,
- agentMbox_sha1sum: doc.agentMbox_sha1sum,
- registration: doc.registration,
- create_date: doc.create_date,
- update_date: doc.update_date,
- jsonPayload: doc.jsonPayload,
- documentName: doc.documentName,
- className: doc.className};
- if(meta.type == "json") {
- if(doc.className && doc.className == "org.apereo.openlrs.model.event.v2.ActivityStateEvent") {
- if (doc.activityId, doc.agentAccountName, doc.registration) {
- emit(varKey, varValue);
- }
- }
- }
- }
Stikked
