forked from EVOgeek/Vmeda.Online
		
	MOBILE-4272 workshop: Fix assessment
This commit is contained in:
		
							parent
							
								
									a07ae84f54
								
							
						
					
					
						commit
						7b5fd672e7
					
				| @ -333,7 +333,7 @@ export class AddonModForumPostComponent implements OnInit, OnDestroy, OnChanges | |||||||
|      * @param text The new text. |      * @param text The new text. | ||||||
|      */ |      */ | ||||||
|     onMessageChange(text?: string | null): void { |     onMessageChange(text?: string | null): void { | ||||||
|         this.formData.message = text ?? ''; |         this.formData.message = text ?? null; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|  | |||||||
| @ -512,7 +512,7 @@ export class AddonModForumNewDiscussionPage implements OnInit, OnDestroy, CanLea | |||||||
|      * @param text The new text. |      * @param text The new text. | ||||||
|      */ |      */ | ||||||
|     onMessageChange(text?: string | null): void { |     onMessageChange(text?: string | null): void { | ||||||
|         this.newDiscussion.message = text ?? ''; |         this.newDiscussion.message = text ?? null; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|  | |||||||
| @ -129,9 +129,7 @@ export class AddonModWorkshopAssessmentStrategyAccumulativeHandlerService implem | |||||||
|                     hasErrors = true; |                     hasErrors = true; | ||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
|                 if (currentValues[idx].peercomment) { |                 data['peercomment__idx_' + idx] = currentValues[idx].peercomment ?? ''; | ||||||
|                     data['peercomment__idx_' + idx] = currentValues[idx].peercomment; |  | ||||||
|                 } |  | ||||||
| 
 | 
 | ||||||
|                 data['gradeid__idx_' + idx] = parseInt(form.current[idx].gradeid, 10) || 0; |                 data['gradeid__idx_' + idx] = parseInt(form.current[idx].gradeid, 10) || 0; | ||||||
|                 data['dimensionid__idx_' + idx] = parseInt(field.dimensionid, 10); |                 data['dimensionid__idx_' + idx] = parseInt(field.dimensionid, 10); | ||||||
|  | |||||||
| @ -112,9 +112,7 @@ export class AddonModWorkshopAssessmentStrategyNumErrorsHandlerService implement | |||||||
|                     hasErrors = true; |                     hasErrors = true; | ||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
|                 if (currentValues[idx].peercomment) { |                 data['peercomment__idx_' + idx] = currentValues[idx].peercomment ?? ''; | ||||||
|                     data['peercomment__idx_' + idx] = currentValues[idx].peercomment; |  | ||||||
|                 } |  | ||||||
| 
 | 
 | ||||||
|                 data['gradeid__idx_' + idx] = parseInt(form.current[idx].gradeid, 10) || 0; |                 data['gradeid__idx_' + idx] = parseInt(form.current[idx].gradeid, 10) || 0; | ||||||
|                 data['dimensionid__idx_' + idx] = parseInt(field.dimensionid, 10); |                 data['dimensionid__idx_' + idx] = parseInt(field.dimensionid, 10); | ||||||
|  | |||||||
| @ -23,12 +23,16 @@ | |||||||
|             phases[workshop!.phase].tasks.length"> |             phases[workshop!.phase].tasks.length"> | ||||||
|             <ion-item button class="ion-text-wrap" *ngFor="let task of phases[workshop!.phase].tasks" |             <ion-item button class="ion-text-wrap" *ngFor="let task of phases[workshop!.phase].tasks" | ||||||
|                 [class.item-dimmed]="task.code == 'submit' && !showSubmit" (click)="runTask(task)" detail="false"> |                 [class.item-dimmed]="task.code == 'submit' && !showSubmit" (click)="runTask(task)" detail="false"> | ||||||
|                 <ion-icon slot="start" name="far-circle" *ngIf="task.completed == null" aria-hidden="true"></ion-icon> |                 <ion-icon slot="start" name="far-circle" *ngIf="task.completed == null" | ||||||
|                 <ion-icon slot="start" name="fas-circle-xmark" color="danger" *ngIf="task.completed == ''" aria-hidden="true"> |                     [attr.aria-label]="'addon.mod_workshop.tasktodo' | translate"></ion-icon> | ||||||
|  |                 <ion-icon slot="start" name="fas-circle-xmark" color="danger" *ngIf="task.completed == ''" | ||||||
|  |                     [attr.aria-label]="'addon.mod_workshop.taskfail' | translate"> | ||||||
|                 </ion-icon> |                 </ion-icon> | ||||||
|                 <ion-icon slot="start" name="fas-circle-info" color="info" *ngIf="task.completed == 'info'" aria-hidden="true"> |                 <ion-icon slot="start" name="fas-circle-info" color="info" *ngIf="task.completed == 'info'" | ||||||
|  |                     [attr.aria-label]="'addon.mod_workshop.taskinfo' | translate"> | ||||||
|                 </ion-icon> |                 </ion-icon> | ||||||
|                 <ion-icon slot="start" name="fas-circle-check" color="success" *ngIf="task.completed == '1'" aria-hidden="true"> |                 <ion-icon slot="start" name="fas-circle-check" color="success" *ngIf="task.completed == '1'" | ||||||
|  |                     [attr.aria-label]="'addon.mod_workshop.taskdone' | translate"> | ||||||
|                 </ion-icon> |                 </ion-icon> | ||||||
|                 <ion-label> |                 <ion-label> | ||||||
|                     <p class="item-heading">{{task.title}}</p> |                     <p class="item-heading">{{task.title}}</p> | ||||||
|  | |||||||
| @ -19,7 +19,7 @@ import { FileEntry } from '@ionic-native/file/ngx'; | |||||||
| import { CoreFile } from '@services/file'; | import { CoreFile } from '@services/file'; | ||||||
| import { CoreFileEntry } from '@services/file-helper'; | import { CoreFileEntry } from '@services/file-helper'; | ||||||
| import { CoreSites } from '@services/sites'; | import { CoreSites } from '@services/sites'; | ||||||
| import { CoreTextUtils } from '@services/utils/text'; | import { CoreTextUtils, CoreTextFormat } from '@services/utils/text'; | ||||||
| import { CoreUtils } from '@services/utils/utils'; | import { CoreUtils } from '@services/utils/utils'; | ||||||
| import { makeSingleton, Translate } from '@singletons'; | import { makeSingleton, Translate } from '@singletons'; | ||||||
| import { CoreFormFields } from '@singletons/form'; | import { CoreFormFields } from '@singletons/form'; | ||||||
| @ -531,6 +531,7 @@ export class AddonModWorkshopHelperProvider { | |||||||
|             (await AddonWorkshopAssessmentStrategyDelegate.prepareAssessmentData(workshop.strategy ?? '', selectedValues, form)) || |             (await AddonWorkshopAssessmentStrategyDelegate.prepareAssessmentData(workshop.strategy ?? '', selectedValues, form)) || | ||||||
|             {}; |             {}; | ||||||
|         data.feedbackauthor = feedbackText; |         data.feedbackauthor = feedbackText; | ||||||
|  |         data.feedbackauthorformat = CoreTextFormat.FORMAT_HTML; | ||||||
|         data.feedbackauthorattachmentsid = attachmentsId; |         data.feedbackauthorattachmentsid = attachmentsId; | ||||||
|         data.nodims = form.dimenssionscount; |         data.nodims = form.dimenssionscount; | ||||||
| 
 | 
 | ||||||
|  | |||||||
							
								
								
									
										115
									
								
								src/addons/mod/workshop/tests/behat/basic_usage.feature
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										115
									
								
								src/addons/mod/workshop/tests/behat/basic_usage.feature
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,115 @@ | |||||||
|  | @mod @mod_workshop @app @javascript | ||||||
|  | Feature: Test basic usage of workshop activity in app | ||||||
|  | 
 | ||||||
|  |   Background: | ||||||
|  |     Given the following "courses" exist: | ||||||
|  |       | fullname | shortname | | ||||||
|  |       | Course 1 | C1        | | ||||||
|  |     And the following "users" exist: | ||||||
|  |       | username | firstname | lastname | | ||||||
|  |       | student1 | First     | Student  | | ||||||
|  |       | student2 | Second    | Student  | | ||||||
|  |       | teacher1 | First     | Teacher  | | ||||||
|  |     And the following "course enrolments" exist: | ||||||
|  |       | user     | course | role    | | ||||||
|  |       | student1 | C1     | student | | ||||||
|  |       | student2 | C1     | student | | ||||||
|  |       | teacher1 | C1     | editingteacher | | ||||||
|  |     And the following "activities" exist: | ||||||
|  |       | activity   | name          | intro                 | course | idnumber | | ||||||
|  |       | workshop   | Test workshop | Workshop description  | C1     | workshop | | ||||||
|  | 
 | ||||||
|  |   Scenario: Take a workshop | ||||||
|  | 
 | ||||||
|  |     # Setup phase | ||||||
|  |     Given I entered the workshop activity "workshop" on course "Course 1" as "teacher1" in the app | ||||||
|  |     Then I should find "Setup phase" in the app | ||||||
|  |     And I should find "Task done" within "Provide instructions for submission" "ion-item" in the app | ||||||
|  |     And I should find "Task done" within "Set the workshop description" "ion-item" in the app | ||||||
|  |     And I should find "Task to do" within "Edit assessment form" "ion-item" in the app | ||||||
|  |     And I should find "Task to do" within "Switch to the next phase" "ion-item" in the app | ||||||
|  | 
 | ||||||
|  |     When I press "Edit assessment form" in the app | ||||||
|  |     And I press "OK" in the app | ||||||
|  |     And I switch to the browser tab opened by the app | ||||||
|  |     And I log in as "teacher1" | ||||||
|  |     And I set the field "id_description__idx_0_editor" to "Was the submission good?" | ||||||
|  |     And I press "Save and close" | ||||||
|  |     And I change phase in workshop "Test workshop" to "Submission phase" | ||||||
|  |     And I close the browser tab opened by the app | ||||||
|  |     And I pull to refresh in the app | ||||||
|  |     Then I should find "Submission phase" in the app | ||||||
|  |     And I should find "Task done" within "Provide instructions for assessment" "ion-item" in the app | ||||||
|  |     And I should find "Task to do" within "Allocate submissions" "ion-item" in the app | ||||||
|  |     And I should find "expected: 2" within "Allocate submissions" "ion-item" in the app | ||||||
|  |     And I should find "submitted: 0" within "Allocate submissions" "ion-item" in the app | ||||||
|  |     And I should find "to allocate: 0" within "Allocate submissions" "ion-item" in the app | ||||||
|  | 
 | ||||||
|  |     # Submission phase | ||||||
|  |     Given I entered the workshop activity "workshop" on course "Course 1" as "student1" in the app | ||||||
|  |     Then I should find "Task to do" within "Submit your work" "ion-item" in the app | ||||||
|  | 
 | ||||||
|  |     When I press "Edit submission" in the app | ||||||
|  |     And I set the field "Title" to "The Answer" in the app | ||||||
|  |     And I set the field "Submission content" to "42" in the app | ||||||
|  |     And I press "Save" in the app | ||||||
|  |     Then I should find "Task done" within "Submit your work" "ion-item" in the app | ||||||
|  |     And I should find "The Answer" in the app | ||||||
|  |     And I should find "42" in the app | ||||||
|  | 
 | ||||||
|  |     Given I entered the workshop activity "workshop" on course "Course 1" as "teacher1" in the app | ||||||
|  |     When I pull to refresh in the app | ||||||
|  |     Then I should find "Submission phase" in the app | ||||||
|  |     And I should find "Task done" within "Provide instructions for assessment" "ion-item" in the app | ||||||
|  |     And I should find "Task to do" within "Allocate submissions" "ion-item" in the app | ||||||
|  |     And I should find "expected: 2" within "Allocate submissions" "ion-item" in the app | ||||||
|  |     And I should find "submitted: 1" within "Allocate submissions" "ion-item" in the app | ||||||
|  |     And I should find "to allocate: 1" within "Allocate submissions" "ion-item" in the app | ||||||
|  | 
 | ||||||
|  |     When I press "Allocate submissions" in the app | ||||||
|  |     And I press "OK" in the app | ||||||
|  |     And I switch to the browser tab opened by the app | ||||||
|  |     And I allocate submissions in workshop "Test workshop" as: | ||||||
|  |       | Participant   | Reviewer       | | ||||||
|  |       | First Student | Second Student | | ||||||
|  |     And I change phase in workshop "Test workshop" to "Assessment phase" | ||||||
|  |     And I close the browser tab opened by the app | ||||||
|  |     And I pull to refresh in the app | ||||||
|  |     Then I should find "Assessment phase" in the app | ||||||
|  | 
 | ||||||
|  |     # Assessment phase | ||||||
|  |     Given I entered the workshop activity "workshop" on course "Course 1" as "student2" in the app | ||||||
|  |     Then I should find "Task to do" within "Assess peers" "ion-item" in the app | ||||||
|  | 
 | ||||||
|  |     When I press "The Answer" in the app | ||||||
|  |     And I press "Grade for Aspect 01" in the app | ||||||
|  |     And I press "10 / 10" in the app | ||||||
|  |     And I press "Save" in the app | ||||||
|  |     Then I should find "Assessed submission" in the app | ||||||
|  | 
 | ||||||
|  |     # Grading evaluation phase | ||||||
|  |     Given I entered the workshop activity "workshop" on course "Course 1" as "teacher1" in the app | ||||||
|  |     And I press "Switch to the next phase" in the app | ||||||
|  |     And I press "OK" in the app | ||||||
|  |     And I switch to the browser tab opened by the app | ||||||
|  |     And I press "Continue" | ||||||
|  |     Then I should see "Grading evaluation phase" | ||||||
|  | 
 | ||||||
|  |     When I press "Re-calculate grades" | ||||||
|  |     Then I should see "calculated: 1" | ||||||
|  | 
 | ||||||
|  |     When I close the browser tab opened by the app | ||||||
|  |     And I pull to refresh in the app | ||||||
|  |     Then I should find "Grading evaluation phase" in the app | ||||||
|  | 
 | ||||||
|  |     # Closed | ||||||
|  |     When I press "Switch to the next phase" in the app | ||||||
|  |     And I press "OK" in the app | ||||||
|  |     And I switch to the browser tab opened by the app | ||||||
|  |     And I press "Continue" | ||||||
|  |     Then I should see "Closed" | ||||||
|  | 
 | ||||||
|  |     When I close the browser tab opened by the app | ||||||
|  |     And I pull to refresh in the app | ||||||
|  |     Then I should find "Closed" in the app | ||||||
|  |     And I should find "Conclusion 1" in the app | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user