示例#1
0
    def get(self):
        paid_survey_users, all_quiz_attempts, all_users, paid_quiz_attempts = self.get_superadmin_index_data()

        context = {
            'paid_survey_users': len(paid_survey_users),
            # 'paid_survey_users_last_30_days': len(User.get_paid_survey_users_last_30_days().fetch())
            'quiz_attempt_data': all_quiz_attempts,
            'all_users': all_users,
            'paid_quiz_attempts': paid_quiz_attempts,
            'env': 'local' if settings.is_devappserver() else 'not-local'
        }

        self.render_response('superadmin/index.html', **context)
示例#2
0
    def get(self, **context):
        """ GET """
        user = User.get_or_create_by_user_id(self.request.GET.get('userId'))
        attempt = QuizAttempt.get_by_user_id(user.user_id, context['quiz_type'])
        if not attempt:
            # Start up a new QuizAttempt!
            attempt = QuizAttempt.create(user_id=user.user_id, quiz_type=context['quiz_type'])
        if settings.is_devappserver():
            user.paid = True
        context.update({
            'user': user,
            'user_id': user.user_id,
            'quiz_attempt': attempt
        })

        logging.info(context)
        self.render_response('survey.html', **context)