@@ -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 {
@@ -124,11 +124,6 @@ public string HRQuestionResponseUri
124124 { _hrQuestionIdsXML }
125125 </condition>
126126 </filter>
127- <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>
131- </link-entity>
132127 </link-entity>
133128 <link-entity name="ofm_question" from="ofm_questionid" to="ofm_header" link-type="outer" alias="header" visible="false">
134129 <attribute name="ofm_question_id" />
@@ -138,10 +133,10 @@ public string HRQuestionResponseUri
138133 </fetch>
139134 """ ;
140135
141- var previousHRQuestionResponseUri = $ """
136+ var previousQuestionResponseUri = $ """
142137 ofm_question_responses?fetchXml={ WebUtility . UrlEncode ( fetchXml ) }
143138 """ . CleanCRLF ( ) ;
144- return previousHRQuestionResponseUri ;
139+ return previousQuestionResponseUri ;
145140 }
146141 }
147142
@@ -401,8 +396,8 @@ public async Task<JsonObject> RunProcessAsync(ID365AppUserService appUserService
401396
402397 //Get question template for current report template
403398
404- var hrQuestionTemplateData = await GetReportDataAsync ( HRQuestionTemplateUri ) ;
405- var serializedHRQuestionTemplateData = System . Text . Json . JsonSerializer . Deserialize < List < Question > > ( hrQuestionTemplateData . Data , Setup . s_writeOptionsForLogs ) ;
399+ var hrQuestionTemplateData = await GetReportDataAsync ( QuestionTemplateUri ) ;
400+ var serializedQuestionTemplateData = System . Text . Json . JsonSerializer . Deserialize < List < Question > > ( hrQuestionTemplateData . Data , Setup . s_writeOptionsForLogs ) ;
406401
407402 List < HttpRequestMessage > questionResponseRequests = [ ] ;
408403
@@ -411,14 +406,14 @@ public async Task<JsonObject> RunProcessAsync(ID365AppUserService appUserService
411406 var uid = report [ "ofm_survey_responseid" ] . ToString ( ) ;
412407 _facId = report [ "_ofm_facility_value" ] . ToString ( ) ;
413408
414- var previousHRQuestionResponseData = await GetReportDataAsync ( HRQuestionResponseUri ) ;
415- var serializedPreviousHRQuestionResponseData = System . Text . Json . JsonSerializer . Deserialize < List < QuestionResponse > > ( previousHRQuestionResponseData . Data , Setup . s_writeOptionsForLogs ) ;
409+ var previousQuestionResponseData = await GetReportDataAsync ( QuestionResponseUri ) ;
410+ var serializedPreviousQuestionResponseData = System . Text . Json . JsonSerializer . Deserialize < List < QuestionResponse > > ( previousQuestionResponseData . Data , Setup . s_writeOptionsForLogs ) ;
416411
417- foreach ( var questionResponse in serializedPreviousHRQuestionResponseData )
412+ foreach ( var questionResponse in serializedPreviousQuestionResponseData )
418413 {
419414
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 } )";
415+ var questionTemplateId = $ "/ofm_questions({ serializedQuestionTemplateData ? . Where ( q => q . ofm_question_id == questionResponse . ofm_question_qid ) . FirstOrDefault ( ) . ofm_questionid } )";
416+ 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 } )";
422417
423418 var newQuestionResponse = new JsonObject
424419 {
@@ -437,7 +432,7 @@ public async Task<JsonObject> RunProcessAsync(ID365AppUserService appUserService
437432
438433 if ( questionResponseRequests . Count == 0 )
439434 {
440- _logger . LogInformation ( CustomLogEvent . Process , "Cannot find HR questions responses." ) ;
435+ _logger . LogInformation ( CustomLogEvent . Process , "Cannot find questions responses." ) ;
441436 return ProcessResult . Completed ( ProcessId ) . SimpleProcessResult ;
442437 }
443438 try
@@ -464,14 +459,14 @@ public async Task<JsonObject> RunProcessAsync(ID365AppUserService appUserService
464459 {
465460 var result = ProcessResult . Failure ( ProcessId , questionResponseBatchResult . Errors , questionResponseBatchResult . TotalProcessed , questionResponseBatchResult . TotalRecords ) ;
466461
467- _logger . LogError ( CustomLogEvent . Process , "Copy HR response process finished with an error {error}" , JsonValue . Create ( result ) ! . ToJsonString ( ) ) ;
462+ _logger . LogError ( CustomLogEvent . Process , "Copy Question response process finished with an error {error}" , JsonValue . Create ( result ) ! . ToJsonString ( ) ) ;
468463
469464 return result . SimpleProcessResult ;
470465 }
471466 }
472467 catch ( Exception ex )
473468 {
474- _logger . LogError ( CustomLogEvent . Process , "Faile to copy HR response isthrowing an error {error}" , ex . Message . ToString ( ) ) ;
469+ _logger . LogError ( CustomLogEvent . Process , "Faile to copy Question response isthrowing an error {error}" , ex . Message . ToString ( ) ) ;
475470
476471 }
477472 #endregion
0 commit comments