@@ -65,7 +65,7 @@ public string RequestUri
6565 }
6666 }
6767
68- public string HRQuestionTemplateUri
68+ public string QuestionTemplateUri
6969 {
7070 get
7171 {
@@ -100,7 +100,7 @@ public string HRQuestionTemplateUri
100100 }
101101 }
102102
103- public string HRQuestionResponseUri
103+ public string QuestionResponseUri
104104 {
105105 get
106106 {
@@ -125,9 +125,6 @@ public string HRQuestionResponseUri
125125 </condition>
126126 </filter>
127127 <link-entity name="ofm_section" from="ofm_sectionid" to="ofm_section">
128- <filter>
129- <condition attribute="ofm_section_title" operator="begins-with" value="Human" />
130- </filter>
131128 </link-entity>
132129 </link-entity>
133130 <link-entity name="ofm_question" from="ofm_questionid" to="ofm_header" link-type="outer" alias="header" visible="false">
@@ -138,10 +135,10 @@ public string HRQuestionResponseUri
138135 </fetch>
139136 """ ;
140137
141- var previousHRQuestionResponseUri = $ """
138+ var previousQuestionResponseUri = $ """
142139 ofm_question_responses?fetchXml={ WebUtility . UrlEncode ( fetchXml ) }
143140 """ . CleanCRLF ( ) ;
144- return previousHRQuestionResponseUri ;
141+ return previousQuestionResponseUri ;
145142 }
146143 }
147144
@@ -401,8 +398,8 @@ public async Task<JsonObject> RunProcessAsync(ID365AppUserService appUserService
401398
402399 //Get question template for current report template
403400
404- var hrQuestionTemplateData = await GetReportDataAsync ( HRQuestionTemplateUri ) ;
405- var serializedHRQuestionTemplateData = System . Text . Json . JsonSerializer . Deserialize < List < Question > > ( hrQuestionTemplateData . Data , Setup . s_writeOptionsForLogs ) ;
401+ var hrQuestionTemplateData = await GetReportDataAsync ( QuestionTemplateUri ) ;
402+ var serializedQuestionTemplateData = System . Text . Json . JsonSerializer . Deserialize < List < Question > > ( hrQuestionTemplateData . Data , Setup . s_writeOptionsForLogs ) ;
406403
407404 List < HttpRequestMessage > questionResponseRequests = [ ] ;
408405
@@ -411,14 +408,14 @@ public async Task<JsonObject> RunProcessAsync(ID365AppUserService appUserService
411408 var uid = report [ "ofm_survey_responseid" ] . ToString ( ) ;
412409 _facId = report [ "_ofm_facility_value" ] . ToString ( ) ;
413410
414- var previousHRQuestionResponseData = await GetReportDataAsync ( HRQuestionResponseUri ) ;
415- var serializedPreviousHRQuestionResponseData = System . Text . Json . JsonSerializer . Deserialize < List < QuestionResponse > > ( previousHRQuestionResponseData . Data , Setup . s_writeOptionsForLogs ) ;
411+ var previousQuestionResponseData = await GetReportDataAsync ( QuestionResponseUri ) ;
412+ var serializedPreviousQuestionResponseData = System . Text . Json . JsonSerializer . Deserialize < List < QuestionResponse > > ( previousQuestionResponseData . Data , Setup . s_writeOptionsForLogs ) ;
416413
417- foreach ( var questionResponse in serializedPreviousHRQuestionResponseData )
414+ foreach ( var questionResponse in serializedPreviousQuestionResponseData )
418415 {
419416
420- var questionTemplateId = $ "/ofm_questions({ serializedHRQuestionTemplateData ? . Where ( q => q . ofm_question_id == questionResponse . ofm_question_qid ) . FirstOrDefault ( ) . ofm_questionid } )";
421- var headerTemplateId = String . IsNullOrEmpty ( questionResponse . ofm_header_qid ) ? null : $ "/ofm_questions({ serializedHRQuestionTemplateData ? . Where ( q => q . ofm_question_id == questionResponse . ofm_header_qid ) . FirstOrDefault ( ) . ofm_questionid } )";
417+ var questionTemplateId = $ "/ofm_questions({ serializedQuestionTemplateData ? . Where ( q => q . ofm_question_id == questionResponse . ofm_question_qid ) . FirstOrDefault ( ) . ofm_questionid } )";
418+ var headerTemplateId = String . IsNullOrEmpty ( questionResponse . ofm_header_qid ) ? null : $ "/ofm_questions({ serializedQuestionTemplateData ? . Where ( q => q . ofm_question_id == questionResponse . ofm_header_qid ) . FirstOrDefault ( ) . ofm_questionid } )";
422419
423420 var newQuestionResponse = new JsonObject
424421 {
@@ -437,7 +434,7 @@ public async Task<JsonObject> RunProcessAsync(ID365AppUserService appUserService
437434
438435 if ( questionResponseRequests . Count == 0 )
439436 {
440- _logger . LogInformation ( CustomLogEvent . Process , "Cannot find HR questions responses." ) ;
437+ _logger . LogInformation ( CustomLogEvent . Process , "Cannot find questions responses." ) ;
441438 return ProcessResult . Completed ( ProcessId ) . SimpleProcessResult ;
442439 }
443440 try
@@ -464,14 +461,14 @@ public async Task<JsonObject> RunProcessAsync(ID365AppUserService appUserService
464461 {
465462 var result = ProcessResult . Failure ( ProcessId , questionResponseBatchResult . Errors , questionResponseBatchResult . TotalProcessed , questionResponseBatchResult . TotalRecords ) ;
466463
467- _logger . LogError ( CustomLogEvent . Process , "Copy HR response process finished with an error {error}" , JsonValue . Create ( result ) ! . ToJsonString ( ) ) ;
464+ _logger . LogError ( CustomLogEvent . Process , "Copy Question response process finished with an error {error}" , JsonValue . Create ( result ) ! . ToJsonString ( ) ) ;
468465
469466 return result . SimpleProcessResult ;
470467 }
471468 }
472469 catch ( Exception ex )
473470 {
474- _logger . LogError ( CustomLogEvent . Process , "Faile to copy HR response isthrowing an error {error}" , ex . Message . ToString ( ) ) ;
471+ _logger . LogError ( CustomLogEvent . Process , "Faile to copy Question response isthrowing an error {error}" , ex . Message . ToString ( ) ) ;
475472
476473 }
477474 #endregion
0 commit comments