• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

samsmithnz / SatisfactoryTree / 17921157049

22 Sep 2025 04:01PM UTC coverage: 66.639% (-1.6%) from 68.215%
17921157049

Pull #314

github

web-flow
Merge 009d93199 into 9b5cf3f1d
Pull Request #314: Add "Add exported Part" button functionality to factory exported parts section

427 of 748 branches covered (57.09%)

Branch coverage included in aggregate %.

0 of 43 new or added lines in 1 file covered. (0.0%)

56 existing lines in 5 files now uncovered.

1159 of 1632 relevant lines covered (71.02%)

1134.38 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/SatisfactoryTree.Web/Pages/Home.razor
1
@page "/"
2

3
<PageTitle>Home</PageTitle>
4

5
@using SatisfactoryTree.Logic
6
@using SatisfactoryTree.Logic.Extraction
7
@using SatisfactoryTree.Logic.Models
8
@using SatisfactoryTree.Web.Services
9
@inject HttpClient Http
10
@inject PlanService PlanService
11

12
@code {
13
        FactoryCatalog? factoryCatalog;
14
        private Plan? plan;
15
        private Factory? screwsFactory;
16
        private Factory? reinforcedPlatesFactory;
UNCOV
17
        private bool isLoading = true;
×
18
        private string? errorMessage;
19

20
        protected override async Task OnInitializedAsync()
UNCOV
21
        {
×
22
                try
UNCOV
23
                {
×
24
                        factoryCatalog = await Http.GetFromJsonAsync<FactoryCatalog>("content/gameData.json");
×
25
                        if (factoryCatalog == null)
×
26
                        {
×
27
                                throw new Exception("FactoryCatalog could not be loaded or found");
×
28
                        }
UNCOV
29
                        plan = new();
×
30
                        screwsFactory = new(1, "Screws factory");
×
31
                        screwsFactory.ExportedParts.Add(new(new() { Name = "IronScrew", Quantity = 12 }));
×
32
                        plan.Factories.Add(screwsFactory);
×
33
                        reinforcedPlatesFactory = new(2, "Reinforced Iron Plates factory");
×
34
                        reinforcedPlatesFactory.ExportedParts.Add(new(new() { Name = "IronPlateReinforced", Quantity = 1 }));
×
35
                        reinforcedPlatesFactory.ImportedParts.Add(1, new(1, "Screws factory", new() { Name = "IronScrew", Quantity = 12 }));
×
36
                        plan.Factories.Add(reinforcedPlatesFactory);
×
37

38
                        //Calculate the production
UNCOV
39
                        plan.UpdatePlanCalculations(factoryCatalog);
×
40

41
                        // Update the PlanService so NavMenu can access the plan
UNCOV
42
                        PlanService.Plan = plan;
×
43

UNCOV
44
                        isLoading = false;
×
UNCOV
45
                }
×
46
                catch (Exception ex)
×
47
                {
×
48
                        errorMessage = ex.Message;
×
49
                        isLoading = false;
×
50
                }
×
51
        }
×
52

53
        private string GetFactoryAnchor(Factory factory)
UNCOV
54
        {
×
55
                // Create a URL-friendly anchor from the factory name (same logic as NavMenu)
56
                return factory.Name.ToLowerInvariant()
×
57
                        .Replace(" ", "-")
×
58
                        .Replace("'", "")
×
59
                        .Replace("&", "and")
×
60
                        .Replace("/", "-")
×
61
                        .Replace("\\", "-")
×
62
                        .Replace("(", "")
×
63
                        .Replace(")", "");
×
64
        }
×
65
}
66

67
@if (isLoading)
×
68
{
×
69
        <p>Loading...</p>
70
}
×
71
else if (!string.IsNullOrEmpty(errorMessage))
×
UNCOV
72
{
×
73
        <div class="alert alert-danger">
74
                <strong>Error:</strong> @errorMessage
×
75
        </div>
76
}
×
77
else if (plan?.Factories != null)
×
78
{
×
79
        <h3>The plan</h3>
80
        @foreach (Factory factory in plan.Factories)
×
81
        {
×
82
                <div id="@GetFactoryAnchor(factory)" class="factory-section">
83
                        <FactoryItems Factory="factory" Parts="factoryCatalog?.Parts" />
84
                </div>
85
        }
×
UNCOV
86
}
×
87
else
88
{
×
89
        <p>No data available.</p>
UNCOV
90
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc