-
Notifications
You must be signed in to change notification settings - Fork 0
/
efm
executable file
·114 lines (89 loc) · 3.64 KB
/
efm
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
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/bin/bash
# Task name input :
printf "\n:: Name the task : \n> "
read task_name
# Best case task time input :
printf "\n:: How much it takes in hours (best case) :\n> "
read best_case_time
# Usual case task time output :
usual_case_time=$(bc <<< "$best_case_time / 8")
usual_case_time_in_hours=0
usual_case_timestring=""
if [ $usual_case_time -lt 1 ];
then
usual_case_timestring="$best_case_time hours"
usual_case_time_in_hours=$best_case_time;
else
usual_case_timestring="$usual_case_time days"
usual_case_time_in_hours=$(bc <<< "$usual_case_time * 24");
fi;
printf "\n## So you can take $usual_case_timestring to work on that task in usual case !\n"
# Obstacles percentage input :
printf "\n:: How is your obstacles percentage :\n> "
read obstacles_percent
# Worst case task time output :
time_to_add_from_percent=$(bc <<< "scale=2; ($usual_case_time_in_hours * $obstacles_percent) / 100")
worst_case_time=$(bc <<< "$usual_case_time_in_hours + $time_to_add_from_percent")
worst_case_time_in_hours=0
worst_case_timestring=""
if (( $(bc <<< "$worst_case_time < 24") ));
then
worst_case_timestring="$worst_case_time hours"
worst_case_time_in_hours=$worst_case_time;
else
worst_case_time_in_days=$(bc <<< "scale=2; $worst_case_time / 24")
worst_case_time_in_hours=$(bc <<< "$worst_case_time_in_days * 24")
worst_case_timestring="$worst_case_time_in_days days";
fi;
printf "\n## So it can take $worst_case_timestring in worst case !\n"
# Input details :
printf "\n\n## Details :\n"
printf "\n** Task Name ** : $task_name \n"
printf "\n** Best Case Time ** : $best_case_time hours \n"
printf "\n** Usual Case Time ** : $usual_case_timestring \n"
printf "\n** Worst Case Time ** : $worst_case_timestring"
# Task time estimation output :
estimated_time=$(bc <<< "scale=2; ($best_case_time + 4 * $usual_case_time_in_hours + $worst_case_time_in_hours ) / 6")
estimated_timestring=""
if (( $(bc <<< "$estimated_time < 24") ));
then
estimated_timestring="$estimated_time hours";
else
estimated_time_in_days=$(bc <<< "scale=2; $estimated_time / 24")
estimated_timestring="$estimated_time_in_days days";
fi;
printf "\n\n\n## In Result, this task will take a mean of : $estimated_timestring !\n"
# Task standard deviation time output :
standard_deviation=$(bc <<< "scale=2; ($worst_case_time_in_hours - $best_case_time) / 6")
standard_deviation_string=""
if (( $(bc <<< "$standard_deviation < 24") ));
then
standard_deviation_string="$standard_deviation hours";
else
standard_deviation_in_days=$(bc <<< "scale=2; $standard_deviation / 24")
standard_deviation_string="$standard_deviation_in_days days";
fi;
printf "\n## With a standard deviation of : $standard_deviation_string !\n"
# Task mean optimistic time estimation output :
mean_optimistic_time=$(bc <<< "$estimated_time - $standard_deviation")
mean_optimistic_timestring=""
if (( $(bc <<< "$mean_optimistic_time < 24") ));
then
mean_optimistic_timestring="$mean_optimistic_time hours";
else
mean_optimistic_time_in_days=$(bc <<< "scale=2; $mean_optimistic_time / 24")
mean_optimistic_timestring="$mean_optimistic_time_in_days days";
fi;
printf "\n## That means, it will take an optimistic mean of : $mean_optimistic_timestring,"
# Task mean pessimistic time estimation output :
mean_pessimistic_time=$(bc <<< "$estimated_time + $standard_deviation")
mean_pessimistic_timestring=""
if (( $(bc <<< "$mean_pessimistic_time < 24") ));
then
mean_pessimistic_timestring="$mean_pessimistic_time hours";
else
mean_pessimistic_time_in_days=$(bc <<< "scale=2; $mean_pessimistic_time / 24")
mean_pessimistic_timestring="$mean_pessimistic_time_in_days days";
fi;
printf " and a pessimistic mean of : $mean_pessimistic_timestring !\n"
printf "\n"