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

samsmithnz / SatisfactoryTree / 17901390351

22 Sep 2025 12:51AM UTC coverage: 68.078% (+0.3%) from 67.811%
17901390351

push

github

web-flow
Merge pull request #310 from samsmithnz/FixingImportsAgain

Added new imported item type

427 of 736 branches covered (58.02%)

Branch coverage included in aggregate %.

91 of 185 new or added lines in 10 files covered. (49.19%)

7 existing lines in 3 files now uncovered.

1149 of 1579 relevant lines covered (72.77%)

1172.07 hits per line

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

0.0
/src/SatisfactoryTree.Web/Components/FactoryItems.razor
1
@using SatisfactoryTree.Logic.Models
2
@using SatisfactoryTree.Web.Services
3
@inject IFactoryItemDisplayService DisplayService
4

5
@code {
6
    [Parameter]
7
    public Factory? Factory { get; set; }
×
8
    [Parameter]
9
    public Dictionary<string, Part>? Parts { get; set; }
×
10

11
    private void OnPartSelected(Part selectedPart, Item item)
12
    {
×
13
        item.Name = selectedPart.Name ?? selectedPart.Name ?? "";
×
14
        StateHasChanged();
×
15
    }
×
16

17
    private Part? GetCurrentPart(Item item)
18
    {
×
19
        if (Parts == null) return null;
×
20
        Parts.TryGetValue(item.Name, out Part? part);
×
21
        return part;
×
22
    }
×
23
}
24

25
@if (Factory != null)
×
26
{
×
27
    <div class="factory-container">
28
        <h3><input type="text" value="@Factory.Name" class="form-control" /></h3>
NEW
29
        @if (Factory.ExportedParts != null && Factory.ExportedParts.Any())
×
30
        {
×
31
            <p><b>Exported parts:</b></p>
32
            <ul>
NEW
33
                @foreach (ExportedItem item in Factory.ExportedParts)
×
34
                {
×
35
                    <li>
36
                        <img src="@DisplayService.GetPartImagePath(item.Item.Name)" alt="@item.Item.Name" class="part-image" />
NEW
37
                                                <strong>@item.Item.Name</strong> - @item.Item.Quantity per/min (@item.PartQuantityExported per/min exported)
×
38
                    </li>
39
                }
×
40
            </ul>
41

42
            <p><b>Component parts:</b></p>
43
            <ul>
44
                @if (Factory.ComponentParts != null && Factory.ComponentParts.Any())
×
45
                {
×
46
                    @foreach (Item item in Factory.ComponentParts)
×
47
                    {
×
48
                        <li>
49
                            <div class="component-part-row">
50
                                <img src="@DisplayService.GetPartImagePath(item.Name)" alt="@item.Name" class="part-image" />
51
                                <TypeaheadDropdown TItem="Part"
52
                                                 Items="@(Parts?.Values)"
53
                                                 DisplayNameSelector="@(part => DisplayService.GetPartDisplayName(part))"
×
54
                                                 IdSelector="@(part => DisplayService.GetPartDisplayName(part))"
×
55
                                                 SelectedItem="@GetCurrentPart(item)"
56
                                                 SelectedItemChanged="@(part => OnPartSelected(part, item))"
×
57
                                                 Placeholder="Search for parts..."
58
                                                 CssClass="me-2">
59
                                    <ItemTemplate Context="part">
60
                                        <strong>@DisplayService.GetPartDisplayName(part)</strong>
×
61
                                        @if (DisplayService.GetPartIsFluid(part))
×
62
                                        {
×
63
                                            <span class="badge badge-small badge-fluid">Fluid</span>
64
                                        }
×
65
                                        @if (DisplayService.GetPartIsFicsmas(part))
×
66
                                        {
×
67
                                            <span class="badge badge-small badge-ficsmas">FICSMAS</span>
68
                                        }
×
69
                                    </ItemTemplate>
70
                                </TypeaheadDropdown>
71
                                <span class="quantity-label">Quantity:</span>
72
                                <input type="text" value="@item.Quantity.ToString()" class="form-control quantity-input" />
73
                            </div>
74
                            
75
                            <div class="component-badges">
76
                                @if (item.Ingredients != null)
×
77
                                {
×
78
                                    @foreach (Item ingredient in item.Ingredients)
×
79
                                    {
×
80
                                        <span class="badge badge-blue">
81
                                            <img src="@DisplayService.GetPartImagePath(ingredient.Name)" alt="@ingredient.Name" class="ingredient-image" />
82
                                            @ingredient.Name @ingredient.Quantity per/min
×
83
                                        </span>
84
                                    }
×
85
                                }
×
86
                                <span class="badge badge-yellow"> 
87
                                    @if (!string.IsNullOrEmpty(item.Building) && DisplayService.HasBuildingImage(item.Building))
×
88
                                    {
×
89
                                        <img src="@DisplayService.GetBuildingImagePath(item.Building)" alt="@item.Building" class="building-image" />
90
                                    }
×
91
                                    else if (!string.IsNullOrEmpty(item.Building))
×
92
                                    {
×
93
                                        <i class="fas fa-building building-icon" title="@item.Building"></i>
94
                                    }
×
95
                                    @item.Building x @Math.Round(item.BuildingQuantity, 2)
×
96
                                </span>
97
                                <span class="badge badge-grey">
98
                                    <i class="fas fa-bolt power-icon" title="Power Usage"></i> @Math.Round(item.BuildingPowerUsage, 1) MW
×
99
                                </span>
100
                            </div>
101
                        </li>
102
                        <hr>
103
                    }
×
104
                }
×
105
                else
106
                {
×
107
                    <li>No component parts.</li>
108
                }
×
109
            </ul>
110

111
            <p><b>Imported parts:</b></p>
112
            <ul>
113
                @if (Factory.ImportedParts != null && Factory.ImportedParts.Any())
×
114
                {
×
NEW
115
                    @foreach (KeyValuePair<int, ImportedItem> item in Factory.ImportedParts)
×
116
                    {
×
117
                        <li>
118
                            <img src="@DisplayService.GetPartImagePath(item.Value.Item.Name)" alt="@item.Value.Item.Name" class="part-image" />
NEW
119
                            <strong>@item.Value.Item.Name</strong> - Quantity: @item.Value.Item.Quantity - from factory: @item.Value.FactoryName (@item.Value.PartQuantityImported per/min imported)
×
120
                        </li>
121
                    }
×
122
                }
×
123
                else
124
                {
×
125
                    <li>No imported parts.</li>
126
                }
×
127
            </ul>
128

129
            <p><b>Raw resources:</b></p>
130
            <span class="badge badge-blue">
131
                <img src='@DisplayService.GetPartImagePath("OreIron")' alt="OreIron" class="ingredient-image" />
132
                <span>Iron Ore 60 per/min</span>
133
            </span>
134
        }
×
135
        else
136
        {
×
137
            <p>No items in this factory.</p>
138
        }
×
139
    </div>
140
}
×
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