コード例 #1
0
ファイル: main.py プロジェクト: AlexeyMK/senior_design
    def finished_round(self, rating=None):
        ses = cherrypy.session
        if condition_get('choice_set') == 'relative_to_past':
            if ses['round'] > 1:
                # save relative ratings
                if rating == 'prefer_current':
                    record_transaction(ses, "5", amount=ses['amount'])
                    record_transaction(ses, "1", amount=ses['last_amount'])
                elif rating == 'prefer_last':
                    record_transaction(ses, "1", amount=ses['amount'])
                    record_transaction(ses, "5", amount=ses['last_amount'])
        else:
            record_transaction(ses, rating)

        ses['round'] += 1

        if ses['round'] > ses['experiment'].num_rounds_per_subject:
            # all done, back to mturk now
            return redirect('finished_experiment', internal=False)
        else:
            # lets start another round!
            return redirect('offer', internal=False)
コード例 #2
0
ファイル: main.py プロジェクト: AlexeyMK/senior_design
  def finished_round(self, rating=None):
    ses = cherrypy.session
    if condition_get('choice_set') == 'relative_to_past': 
      if ses['round'] > 1:
        # save relative ratings
        if rating == 'prefer_current':
          record_transaction(ses, "5", amount=ses['amount']) 
          record_transaction(ses, "1", amount=ses['last_amount']) 
        elif rating == 'prefer_last':
          record_transaction(ses, "1", amount=ses['amount']) 
          record_transaction(ses, "5", amount=ses['last_amount']) 
    else:
      record_transaction(ses, rating) 

    ses['round'] += 1

    if ses['round'] > ses['experiment'].num_rounds_per_subject:
      # all done, back to mturk now
      return redirect('finished_experiment', internal=False)
    else:
    # lets start another round!
      return redirect('offer', internal=False)
コード例 #3
0
ファイル: main.py プロジェクト: AlexeyMK/senior_design
  def offer(self):
    ses = cherrypy.session
    if not 'round' in cherrypy.session:
      ses['round'] = 1

    experiment = ses['experiment']

    if ses['round'] > experiment.num_rounds_per_subject:
      # all done, back to mturk now
      return redirect('finished_experiment', internal=False)
    else:
      #TODO - ask experiment to configure this randomness 
      amount = random.randint(0,10)
      ses['last_amount'] = ses.get('amount')
      ses['amount'] = amount
      ses['start_time'] = datetime.datetime.now()
      return render_for_experiment('offer.html', experiment, amount=amount)
コード例 #4
0
ファイル: main.py プロジェクト: AlexeyMK/senior_design
    def offer(self):
        ses = cherrypy.session
        if not 'round' in cherrypy.session:
            ses['round'] = 1

        experiment = ses['experiment']

        if ses['round'] > experiment.num_rounds_per_subject:
            # all done, back to mturk now
            return redirect('finished_experiment', internal=False)
        else:
            #TODO - ask experiment to configure this randomness
            amount = random.randint(0, 10)
            ses['last_amount'] = ses.get('amount')
            ses['amount'] = amount
            ses['start_time'] = datetime.datetime.now()
            return render_for_experiment('offer.html',
                                         experiment,
                                         amount=amount)
コード例 #5
0
ファイル: main.py プロジェクト: AlexeyMK/senior_design
 def index(self):
     return redirect('intro', internal=False)
コード例 #6
0
ファイル: main.py プロジェクト: AlexeyMK/senior_design
 def index(self):
   return redirect('intro', internal=False)