/// <summary> /// Compares between the two functional units /// +1 for evert correct value /// -1 for every unlike value /// -0.25 for every null value that has been set by the student /// </summary> /// <param name="computerSolution"></param> /// <param name="studentSolution"></param> /// <returns>The student mark</returns> public static float CompareFunctionUnits(this FunctionalUnitWithStatusModel computerSolution, FunctionalUnitWithStatusModel studentSolution) { //The student mark float mark = 0; if (computerSolution.IsBusy) { //Correct each filed mark += computerSolution.IsBusy == studentSolution.IsBusy ? 1 : 0; mark += SharedMethods.CompareFiledsAndGetMark(computerSolution.Time, studentSolution.Time); mark += SharedMethods.CompareFiledsAndGetMark(computerSolution.Operation, studentSolution.Operation); mark += SharedMethods.CompareFiledsAndGetMark(computerSolution.WaitingOperationForSource01, studentSolution.WaitingOperationForSource01); mark += SharedMethods.CompareFiledsAndGetMark(computerSolution.WaitingOperationForSource02, studentSolution.WaitingOperationForSource02); mark += computerSolution.IsSource01Ready == studentSolution.IsSource01Ready ? 1 : 0; mark += SharedMethods.CompareFiledsAndGetMark(computerSolution.SourceRegistery01, studentSolution.SourceRegistery01); mark += SharedMethods.CompareFiledsAndGetMark(computerSolution.TargetRegistery, studentSolution.TargetRegistery); var source02Mark = SharedMethods.CompareFiledsAndGetMark(computerSolution.SourceRegistery02, studentSolution.SourceRegistery02); if (source02Mark > 0) { mark += computerSolution.IsSource02Ready == studentSolution.IsSource02Ready ? 1 : 0; mark += source02Mark; } } return(mark); }