Skip to content
This repository has been archived by the owner on Oct 4, 2022. It is now read-only.

Commit

Permalink
Some DB optimizations. Addresses Issue #29
Browse files Browse the repository at this point in the history
  • Loading branch information
tgpatel committed Nov 5, 2014
1 parent 02bed12 commit 3f443ef
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion vcweb/core/subjectpool/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def experimenter_index(request):
sessions.
"""
experimenter = request.user.experimenter
data = ExperimentSession.objects.filter(creator=request.user)
data = ExperimentSession.objects.select_related('experiment_metadata').filter(creator=request.user)
experiment_metadata_list = [em.to_dict() for em in ExperimentMetadata.objects.bookmarked(experimenter)]
session_list = [session.to_dict() for session in data]
potential_participants_count = Participant.objects.active().count()
Expand Down
9 changes: 5 additions & 4 deletions vcweb/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1295,16 +1295,17 @@ def edit_experiment_configuration(request, pk):


def get_experiment_configuration_json_data(ec):
epv = ExperimentParameterValue.objects.filter(experiment_configuration=ec)
epv = ExperimentParameterValue.objects.select_related('experiment_configuration', 'parameter') \
.filter(experiment_configuration=ec)
exp_param_values_list = [param.to_dict() for param in epv]

round_config = RoundConfiguration.objects.filter(experiment_configuration=ec)
round_config = RoundConfiguration.objects.select_related('experiment_configuration') \
.filter(experiment_configuration=ec)
round_config_list = [round.to_dict() for round in round_config]

round_param_values = RoundParameterValue.objects.select_related('round_configuration', 'parameter') \
.filter(round_configuration__in=round_config)
round_param_values_list = [round_param.to_dict()
for round_param in round_param_values]
round_param_values_list = [round_param.to_dict() for round_param in round_param_values]

# Get the round parameter values for each round
for round in round_config_list:
Expand Down

0 comments on commit 3f443ef

Please sign in to comment.