Exemplo n.º 1
0
def updated_grant_with_activity(updated_grant, profile):
    kwargs = {
        'created_on': datetime(2018, 12, 28, 14, 22, 35, tzinfo=UTC),
        'profile': profile,
        'grant': updated_grant,
        'activity_type': 'update_grant',
    }
    activity = Activity(**kwargs)
    activity.save(update=False)
    return updated_grant
Exemplo n.º 2
0
def cancelled_subscription_with_activity(cancelled_subscription, profile):
    kwargs = {
        'created_on': datetime(2018, 12, 31, 14, 22, 35, tzinfo=UTC),
        'profile': profile,
        'subscription': cancelled_subscription,
        'activity_type': 'killed_grant_contribution',
    }
    activity = Activity(**kwargs)
    activity.save(update=False)
    return cancelled_subscription
Exemplo n.º 3
0
def new_contribution_with_activity(new_contribution, profile):
    kwargs = {
        'created_on': datetime(2018, 12, 29, 14, 22, 35, tzinfo=UTC),
        'profile': profile,
        'subscription': new_contribution,
        'activity_type': 'new_grant_contribution',
    }
    activity = Activity(**kwargs)
    activity.save(update=False)
    return new_contribution
Exemplo n.º 4
0
def generate_assessments(user, n):
    """
    generate a assessment activities for user
    """
    activity = "http://www.example.com/fake/assessment/%d" % (randint(1,1000),)
    value = round(gauss(50,15))

    act = Activity(user=user,
                   type="http://adlnet.gov/expapi/activities/assessment",
                   verb="http://adlnet.gov/expapi/verbs/completed",
                   activity=activity,
                   value=value,
                   name="Fake",
                   description="Fake Assessment")
    act.save()
Exemplo n.º 5
0
Arquivo: views.py Projeto: nprun/f12
def index(request):
    activity_type_list = ActivityType.get_user_activity_type_list(request.user['email'])

    if request.method == 'GET':
        form = forms.ActivityListForm()
        form.prepare(activity_type_list)
        filters = {}
    else:
        form = forms.ActivityListForm(request.POST)
        form.prepare(activity_type_list)
        if form.is_valid():
            filters = form.cleaned_data
        else:
            filters = {}

    activity_list = Activity.get_user_activity(request.user['email'], filters)
    return render(request, 'report_index.html', locals())