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

samsmithnz / SatisfactoryTree / 17380522898

01 Sep 2025 02:28PM UTC coverage: 52.786% (+0.4%) from 52.406%
17380522898

Pull #274

github

web-flow
Merge a3d0a55df into 199d2c420
Pull Request #274: Replace TreeView with ListView and implement auto-population of production dependencies

517 of 657 branches covered (78.69%)

Branch coverage included in aggregate %.

54 of 71 new or added lines in 3 files covered. (76.06%)

1880 of 3884 relevant lines covered (48.4%)

2449.32 hits per line

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

88.46
/src/SatisfactoryTree/Models/Factory.cs
1
namespace SatisfactoryTree.Models
2
{
3
    public class Factory
4
    {
5
        public Factory(string id, string name = "")
24✔
6
        {
24✔
7
            Id = id;
24✔
8
            Name = string.IsNullOrEmpty(name) ? $"Factory {id}" : name;
24✔
9
            Storage = new Storage(id);
24✔
10
            ProductionGoals = new List<ProductionGoal>();
24✔
11
        }
24✔
12

13
        public string Id { get; set; }
41✔
14
        public string Name { get; set; }
27✔
15
        public Storage Storage { get; set; }
41✔
16
        public List<ProductionGoal> ProductionGoals { get; set; }
54✔
17

18
        public ProductionGoal AddProductionGoal(string itemName, decimal targetQuantity)
19
        {
17✔
20
            var goal = new ProductionGoal(itemName, targetQuantity, Id);
17✔
21
            ProductionGoals.Add(goal);
17✔
22
            return goal;
17✔
23
        }
17✔
24

25
        public void RemoveProductionGoal(string goalId)
26
        {
×
27
            ProductionGoals.RemoveAll(g => g.Id == goalId);
×
28
        }
×
29

30
        public void RemoveProductionGoal(ProductionGoal goal)
NEW
31
        {
×
NEW
32
            ProductionGoals.Remove(goal);
×
NEW
33
        }
×
34

35
        public List<ProductionGoal> GetActiveGoals()
36
        {
12✔
37
            return ProductionGoals.Where(g => !g.IsCompleted).ToList();
31✔
38
        }
12✔
39

40
        public List<ProductionGoal> GetCompletedGoals()
41
        {
1✔
42
            return ProductionGoals.Where(g => g.IsCompleted).ToList();
3✔
43
        }
1✔
44

45
        public void ProcessProduction(string itemName, decimal quantity)
46
        {
5✔
47
            // Update active goals for this item
48
            var activeGoals = GetActiveGoals().Where(g => g.ItemName == itemName).ToList();
13✔
49
            decimal remainingQuantity = quantity;
5✔
50

51
            foreach (var goal in activeGoals)
27✔
52
            {
6✔
53
                if (remainingQuantity <= 0) break;
6✔
54

55
                var neededQuantity = goal.GetRemainingQuantity();
6✔
56
                var quantityToAllocate = Math.Min(neededQuantity, remainingQuantity);
6✔
57

58
                goal.UpdateProgress(quantityToAllocate);
6✔
59
                remainingQuantity -= quantityToAllocate;
6✔
60
            }
6✔
61

62
            // Send remaining quantity to storage
63
            if (remainingQuantity > 0)
5✔
64
            {
2✔
65
                Storage.AddItem(itemName, remainingQuantity);
2✔
66
            }
2✔
67
        }
5✔
68
    }
69
}
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

© 2025 Coveralls, Inc