Updated appsettings.json file to change base api url based on environment. Also fixed bug in calculation of yield percentage.

This commit is contained in:
Daniel Wathen
2023-01-05 15:10:40 -07:00
parent 3922d28a8b
commit 6de41bc8da
7 changed files with 49 additions and 33 deletions

View File

@ -6,7 +6,14 @@ namespace ReportingServices.UI.Controllers
{
public class PlanningReportController : Controller
{
private readonly string _baseUrl = "https://localhost:7196/api/ScrapeDB/";
private readonly IConfiguration _configuration;
private readonly string _baseUrl;
public PlanningReportController(IConfiguration configuration)
{
_configuration = configuration;
_baseUrl = _configuration.GetValue<string>("BaseAPIAddress") + "ScrapeDB/";
}
public IActionResult Index()
{

View File

@ -8,12 +8,16 @@ namespace ReportingServices.UI.Controllers
public class ProductionReportController : Controller
{
private readonly ILogger<ProductionReportController> _logger;
private readonly IConfiguration _configuration;
private readonly string _dailyRptFilePath = "wwwroot/Assets/DailyReportInfo.json";
private readonly string _toolStateOwnerFilePath = "wwwroot/Assets/ToolStates.json";
private readonly string _baseUrl;
public ProductionReportController(ILogger<ProductionReportController> logger)
public ProductionReportController(ILogger<ProductionReportController> logger, IConfiguration configuration)
{
_logger = logger;
_configuration = configuration;
_baseUrl = _configuration.GetValue<string>("BaseAPIAddress");
}
@ -24,9 +28,12 @@ namespace ReportingServices.UI.Controllers
public IActionResult DailyReport()
{
string baseFabTimeUrl = _baseUrl + "FabTime/";
string baseScrapeDbUrl = _baseUrl + "ScrapeDB/";
try
{
DailyReport dailyReport = DailyReportHelper.SetUpDailyReport();
DailyReport dailyReport = DailyReportHelper.SetUpDailyReport(baseFabTimeUrl, baseScrapeDbUrl);
Dictionary<string, List<string>> toolStateOwners = JsonFileHandler.LoadJSONFile<Dictionary<string, List<string>>>(_toolStateOwnerFilePath);
dailyReport.ToolStatesByOwner = toolStateOwners;