-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathprocess.go
More file actions
100 lines (83 loc) 路 2.43 KB
/
Copy pathprocess.go
File metadata and controls
100 lines (83 loc) 路 2.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
package main
type Commit struct {
// Requirement string
// Statisifier string
Activity string
// Person string
}
type SatisfactionAudit struct {
Complete bool
Name string
Count int
ExpectedCount int
Commits []Commit
}
type RequirementAudit struct {
HasComplete bool
Name string
SatCommits []SatisfactionAudit
}
type TaskAudit struct {
Name string
Person string
ReqCommits []RequirementAudit
}
type WhatsLeft struct {
Name string
Person string
ReqCommits []RequirementAudit
}
func RunAudit(task TaskMap, activitylog ActivityLog) (*TaskAudit, *WhatsLeft) {
counter := 0
taskAudit := new(TaskAudit)
whatsLeft := new(WhatsLeft)
taskAudit.Name = task.Name
// This loops over all of the requirements in the task (i)
for i := 0; i < len(task.Requirements); i++ {
reqAudit := new(RequirementAudit)
reqAudit.HasComplete = false
// list of OR statements
// This loops through all of the possible satisfiers (j)
for j := 0; j < len(task.Requirements[i].Satisfiers); j++ {
hitCount := 0
audit := new(SatisfactionAudit)
commit := new(Commit)
// Now we want to check the requirements and care about the true
// list of AND statements
// This loop goes through all of the AND statment assets
for l := 0; l < len(task.Requirements[i].Satisfiers[j].Core); l++ {
thecore := task.Requirements[i].Satisfiers[j].Core[l]
// fmt.Println(counter)
if activitylog.Completed[thecore] {
// fmt.Println(counter)
hitCount++
// commit.Requirement = task.Requirements[i].Name
commit.Activity = thecore
// commit.Person = activitylog.Name
// fmt.Println(*commit)
audit.Commits = append(audit.Commits, *commit)
}
}
audit.Count = hitCount
audit.ExpectedCount = task.Requirements[i].Satisfiers[j].Count
audit.Name = task.Requirements[i].Satisfiers[j].Uuid
if audit.Count >= audit.ExpectedCount {
audit.Complete = true
reqAudit.HasComplete = true
}
if len(audit.Commits) > 0 {
reqAudit.SatCommits = append(reqAudit.SatCommits, *audit)
}
counter++
}
reqAudit.Name = task.Requirements[i].Name
if reqAudit.HasComplete == false {
whatsLeft.ReqCommits = append(whatsLeft.ReqCommits, *reqAudit)
}
// fmt.Println(*reqAudit)
taskAudit.Person = activitylog.Name
// taskAudit.AuditID = activitylog.
taskAudit.ReqCommits = append(taskAudit.ReqCommits, *reqAudit)
}
return taskAudit, whatsLeft
}