-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TNO-2072 Charts can now pull content from another report #1458
Conversation
Add DB migration 1.0.115 Publish tno-core:0.1.21 Update Reporting Service Update Editor app Update Subscriber app Update API
content = content.AppendRange(await _reportHelper.FindContentAsync(model.Filter, model.Index)); | ||
|
||
// If this chart pulls data from a linked report add this content. | ||
var sections = model.LinkedReportId.HasValue ? _reportHelper.GetLinkedReportContent(model.LinkedReportId.Value, null).Result : new(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any section that references a linked report needs to fetch that report's content for the current instance.
/// <param name="reportId"></param> | ||
/// <param name="ownerId"></param> | ||
/// <returns></returns> | ||
public Task<Dictionary<string, ReportSectionModel>> GetLinkedReportContent(int reportId, int? ownerId = null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The magic is mostly done here.
[ProducesResponseType(typeof(ErrorResponseModel), (int)HttpStatusCode.BadRequest)] | ||
[ProducesResponseType((int)HttpStatusCode.NoContent)] | ||
[SwaggerOperation(Tags = new[] { "Report" })] | ||
public IActionResult GetCurrentInstance(int id, int? requestorId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needed to add this endpoint so that the Reporting Service has a way to get the linked report content.
@@ -316,9 +314,35 @@ public async Task<IActionResult> Generate(int id, [FromQuery] bool regenerate = | |||
|
|||
var instances = _reportService.GetLatestInstances(id, user.Id); | |||
var currentInstance = instances.FirstOrDefault(); | |||
if (regenerate && currentInstance != null && currentInstance.SentOn.HasValue == false) | |||
if (currentInstance == null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed a bug where a report would be stuck after it was accepted by CHES but the SentOn date wasn't updated correctly. I don't like this implementation.
@@ -232,7 +232,7 @@ export const ReportEdit: React.FC = () => { | |||
</Button> | |||
) : ( | |||
<Button | |||
onClick={() => handleRegenerate(values, false)} | |||
onClick={() => handleRegenerate(values, true)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to for a new generation
|
||
// If the section has content add it to the chart request. | ||
if (!settings.UseAllContent && sectionContent.TryGetValue(section.Name, out ReportSectionModel? sectionData) && sectionData != null) | ||
{ | ||
content.AddRange(sectionData.Content); | ||
} | ||
if (section.LinkedReportId.HasValue) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using a callback go get the linked report.
We can now add Media Analytics sections to a report that reference another report and group the content by sections. This feature requires the report to have an active Report Instance, otherwise the chart will be empty.
Summary
Editor Report Admin
Editor Chart Template Admin
Subscriber Report Admin
Subscriber Report Preview