You are here

Using Drupal views to display overall percentage score for groups of quizzes- Math expression and Views Aggregation Plus (VAP) Opigno Quiz Module

The problem:

Client wanted to display the percentage score of four quizzes based on the max score possible for all four quizzes combined. Opigno Course actually takes the percentage scores of each quiz result and averages them. This client did not want that.

Soooooo here's what I did.

 

The view:  (My Quizzes/Lessons are renamed "Core Characteristics")

math1.PNG

The relationships:

relationships.PNG

Using Table with Aggregation:

mat21.PNG

The fields

Add a Global field, I used cumulated but I think you can use custom text also.

fields.PNG

 

Create Labels on your fields that will be used in you displayed view for the user.
I added 1. Maxium points possible 2. Your total for this Key Element: (points) 3. Your total % for this Key Element: (Percent Score of all the users earned points)

create-labels.PNG

 

Add the filters to current users and the nodes (Quizzes) you would like in the view. (I used filter groups. Nodes are in the "Or" group and current user is in the "Add" filter group. Groupings are already available in views)

filters4.PNG

The filter groups are found by clicking on "Rearrange" in the filter area. ("Add")

add filter-groups.PNG

 

 

VAP Table with Aggregation settings

mat3.PNG
 

The math expression

[points_awarded]/ 316 * 100

"316" is the total of the quizzes Max Points. Your denominator will be different. 

Add CSS to the view for hiding unwanted rows

add-css-to-rows_0.PNG

 

CCS to add to your CCS override file to hide the unwanted rows.

.key-x-row {
 display: none; 
}

 

End results for your user display

end-result.PNG