Esempio n. 1
0
def process_uploaded_quizresponses(request, quiz_responses, user, user_api_key):
    request.user = user
    for quizattempt in quiz_responses:
        success, results = create_resource(QuizAttemptResource, request, quizattempt)
        if success:
            messages.info(request, _(u"Quiz attempt for %(username)s added" % {'username': user.username}))
        else:
            messages.info(request,
                          _(u"Already uploaded: quiz attempt for %(username)s added" % {'username': user.username}))
Esempio n. 2
0
def process_uploaded_trackers(request, trackers, user, user_api_key):
    request.user = user
    for tracker in trackers:
        success, results = create_resource(TrackerResource, request, tracker)
        if success:
            messages.info(request, _(u"Tracker activity for %(username)s added" % {'username': user.username}))
        else:
            messages.warning(request, _(
                u"Already uploaded: tracker activity %(uuid)s for %(username)s added" % {'username': user.username,
                                                                                         'uuid': tracker.get('digest')}), 'danger')
Esempio n. 3
0
def process_uploaded_quizresponses(messages_delegate, quiz_responses, user):

    request = HttpRequest()
    request.user = user
    for quizattempt in quiz_responses:
        success, results = create_resource(QuizAttemptResource, request,
                                           quizattempt)
        if success:
            messages_delegate.info(
                _(u"Quiz attempt for %(username)s added" %
                  {'username': user.username}))
        else:
            messages_delegate.info(
                _(u"Already uploaded: quiz attempt for %(username)s added" %
                  {'username': user.username}))
Esempio n. 4
0
def process_uploaded_trackers(messages_delegate, trackers, user):

    request = HttpRequest()
    request.user = user
    for tracker in trackers:
        success, results = create_resource(TrackerResource, request, tracker)
        if success:
            messages_delegate.info(
                _(u"Tracker activity %(uuid)s for %(username)s added" % {
                    'username': user.username,
                    'uuid': tracker.get('digest')
                }))
        else:
            messages_delegate.warning(
                _(u"Already uploaded: tracker activity %(uuid)s for "
                  "%(username)s" % {
                      'username': user.username,
                      'uuid': tracker.get('digest', None)
                  }), 'danger')