prepareActivities() {
    Object.values(this.getRawActivities()).forEach((rawActivity) => {
      const activityDoc = new Activity(rawActivity);
      this.updateActivityLocations(activityDoc);

      // Validate activity against Activity model
      const validationError = activityDoc.validateSync();
      if (validationError) {
        this.invalidActivities.push({
          activity: activityDoc,
          error: `Activity ${activityDoc.id} validation errors: ${JSON.stringify(validationError.errors)}`,
        });
      } else {
        this.activityDocs.push(activityDoc);
      }
    });
  }
/**
   * Create Activity documents from formatted data
   * and validate so they can be saved
   */
Create Activity documents from formatted data
and validate so they can be saved
Create Activity documents from formatted data and validate so they can be saved
prepareActivities() {
    Object.values(this.getRawActivities()).forEach((rawActivity) => {
      const activityDoc = new Activity(rawActivity);
      this.updateActivityLocations(activityDoc);
      const validationError = activityDoc.validateSync();
      if (validationError) {
        this.invalidActivities.push({
          activity: activityDoc,
          error: `Activity ${activityDoc.id} validation errors: ${JSON.stringify(validationError.errors)}`,
        });
      } else {
        this.activityDocs.push(activityDoc);
      }
    });
  }
prepareActivities ( ) { Object . values ( this . getRawActivities ( ) ) . forEach ( ( rawActivity ) => { const activityDoc = new Activity ( rawActivity ) ; this . updateActivityLocations ( activityDoc ) ; const validationError = activityDoc . validateSync ( ) ; if ( validationError ) { this . invalidActivities . push ( { activity : activityDoc , error : ` ${ activityDoc . id } ${ JSON . stringify ( validationError . errors ) } ` , } ) ; } else { this . activityDocs . push ( activityDoc ) ; } } ) ; }
Create Activity documents from formatted data
 and validate so they can be saved
Create Activity documents from formatted data and validate so they can be saved
// Validate activity against Activity model