{"size": 767, "ext": "js", "max_stars_repo_path": "mongo/task_status.js", "max_stars_repo_name": "stevennuo/panther", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "mongo/task_status.js", "max_issues_repo_name": "stevennuo/panther", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "mongo/task_status.js", "max_forks_repo_name": "stevennuo/panther", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 36.5238095238, "max_line_length": 104, "alphanum_fraction": 0.5840938722}
var cursor = db.stat.find({"data.event":"FinishLesson"});
while ( cursor.hasNext() ) {
    var track = cursor.next();
    var properties = track.data.properties;
    var pass = (Math.random()<.8)
    var star = pass?1:0;
    
    if(properties.LessonId && properties.ChapterId && properties.LayerId && properties._id && track._id)
        db.task_status.update(
            {
                task:ObjectId(properties.LessonId),user: ObjectId(properties._id)
            },{
                isPassed:pass, star:NumberInt(star),
                user: ObjectId(properties._id), chapter:ObjectId(properties.ChapterId),
                topic: ObjectId(properties.LayerId), task:ObjectId(properties.LessonId)
            },{
                upsert: true
            });
}

