def create_some_learner_data():
 user = CreateStudentMixin.create_student()
 attempt_states = (('not started', 0, 0), ('completed', 100, 15), ('attempted', 50, 10), ('struggling', 30, 25))
 exercises = get_random_content(kinds=['Exercise'], limit=len(attempt_states))
 for state in attempt_states:
  exercise = exercises.pop()
  (log, created) = ExerciseLog.objects.get_or_create(exercise_id=exercise.get('id'), user=user)
  if ('not started' != state[0]):
   (log.streak_progress, log.attempts) = state[1:]
   for i in range(0, log.attempts):
    AttemptLog.objects.get_or_create(exercise_id=exercise.get('id'), user=user, seed=i, timestamp=datetime.datetime.now())
   log.latest_activity_timestamp = datetime.datetime.now()
   log.save()

def create_some_learner_data ( ) : user = CreateStudentMixin . create_student ( ) attempt_states = ( ( 'not started' , 0 , 0 ) , ( 'completed' , 100 , 15 ) , ( 'attempted' , 50 , 10 ) , ( 'struggling' , 30 , 25 ) ) exercises = get_random_content ( kinds = [ 'Exercise' ] , limit = len ( attempt_states ) ) for state in attempt_states : exercise = exercises . pop ( ) ( log , created ) = ExerciseLog . objects . get_or_create ( exercise_id = exercise . get ( 'id' ) , user = user ) if ( 'not started' != state [ 0 ] ) : ( log . streak_progress , log . attempts ) = state [ 1 : ] for i in range ( 0 , log . attempts ) : AttemptLog . objects . get_or_create ( exercise_id = exercise . get ( 'id' ) , user = user , seed = i , timestamp = datetime . datetime . now ( ) ) log . latest_activity_timestamp = datetime . datetime . now ( ) log . save ( )
just create a lil bit-o-data of each type .