CSC/ECE 517 Fall 2016 E1682: Improve score calculation

From Expertiza_Wiki
Revision as of 19:47, 9 November 2016 by Nthanik (talk | contribs) (Created page with "E1682. Improve score calculation === Sub class 1: on_the_fly_calc === An object of on_the_fly_calc is called when the deadline_type is not "review of review" which means that th...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

E1682. Improve score calculation

Sub class 1: on_the_fly_calc

An object of on_the_fly_calc is called when the deadline_type is not "review of review" which means that the assignment is ongoing and has not been completed and stores the scores till the current stage that will change once the assignment passes the deadline

The function compute_total_scores(scores) is used to calculate the total score based on each response to each criterion. The function is as below:

def compute_total_scores(scores)

total=0

self.questionnaires.each{|questionnaire| total+=questionnaire.get_weighted_score(self,scores)}

total

end

The value in variable "total" needs to be stored in local_db_scores under "Score" and will be retrieved by using another function retrieve_total_score to display the total score instead of calculating it every time a user wants to view the scores.

Sub class 2: LocalDB_calc

An object of LocalDB_calc is called when the deadline_type is "review of review" which means that the assignment is completed and stores the final score in the database local_db_scores after computing it rather than computing it every time the score is required.

Function compute_total_scores(scores) is added to the class which calculates the total score based on each response to each criterion. The function(polymorphism) is as below:

def compute_total_scores(scores)

total=0

self.questionnaires.each{|questionnaire| total+=questionnaire.get_weighted_score(self,scores)}

total

end

The value in variable "total" needs to be stored in local_db_scores under "Score" and will be retrieved by using another function retrieve_total_score to display the total score instead of calculating it every time a user wants to view the scores.

flowchart