salesforce_certification_calculator 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +114 -0
- data/Rakefile +15 -0
- data/bin/salesforce_certification_calculator +5 -0
- data/data/Administrator-Spring2022.xml +40 -0
- data/data/AdvancedAdministrator-Spring2022.xml +40 -0
- data/data/B2BSolutionArchitect-Spring2022.xml +30 -0
- data/data/B2CSolutionArchitect-Spring2022.xml +30 -0
- data/data/DataArchitect-Spring2022.xml +35 -0
- data/data/DevelopmentLifecycleAndDeploymentArchitect-Spring2022.xml +45 -0
- data/data/EducationCloudConsultant-Spring2022.xml +35 -0
- data/data/ExperienceCloudConsultant-Spring2022.xml +45 -0
- data/data/IdentityAndAccessManagementArchitect-Spring2022.xml +35 -0
- data/data/IntegrationArchitect-Spring2022.xml +35 -0
- data/data/JavaScriptDeveloperI-Spring2022.xml +40 -0
- data/data/MarketingCloudAdministrator-Spring2022.xml +30 -0
- data/data/MarketingCloudConsultant-Spring2022.xml +35 -0
- data/data/MarketingCloudDeveloper-Spring2022.xml +30 -0
- data/data/MarketingCloudEmailSpecialist-Spring2022.xml +30 -0
- data/data/PlatformAppBuilder-Spring2022.xml +30 -0
- data/data/PlatformDeveloperI-Spring2022.xml +25 -0
- data/data/PlatformDeveloperII-Spring2022.xml +30 -0
- data/data/SalesCloudConsultant-Spring2022.xml +55 -0
- data/data/ServiceCloudConsultant-Spring2022.xml +50 -0
- data/data/SharingAndVisibilityArchitect-Spring2022.xml +20 -0
- data/lib/salesforce_certification_calculator/exam.rb +63 -0
- data/lib/salesforce_certification_calculator/file_reader.rb +53 -0
- data/lib/salesforce_certification_calculator/section.rb +25 -0
- data/lib/salesforce_certification_calculator/u_i.rb +107 -0
- data/lib/salesforce_certification_calculator.rb +92 -0
- data/test/test_exam.rb +498 -0
- data/test/test_file_reader.rb +65 -0
- data/test/test_salesforce_certification_calculator.rb +189 -0
- data/test/test_section.rb +59 -0
- data/test/test_u_i.rb +297 -0
- metadata +98 -0
@@ -0,0 +1,30 @@
|
|
1
|
+
<exam>
|
2
|
+
<title>Marketing Cloud Email Specialist - Spring 2022</title>
|
3
|
+
|
4
|
+
<sections>
|
5
|
+
<section>
|
6
|
+
<name>Email Marketing Best Practices</name>
|
7
|
+
<weight>10</weight>
|
8
|
+
</section>
|
9
|
+
|
10
|
+
<section>
|
11
|
+
<name>Content Creation and Delivery</name>
|
12
|
+
<weight>24</weight>
|
13
|
+
</section>
|
14
|
+
|
15
|
+
<section>
|
16
|
+
<name>Marketing Automation</name>
|
17
|
+
<weight>26</weight>
|
18
|
+
</section>
|
19
|
+
|
20
|
+
<section>
|
21
|
+
<name>Subscriber and Data Management</name>
|
22
|
+
<weight>26</weight>
|
23
|
+
</section>
|
24
|
+
|
25
|
+
<section>
|
26
|
+
<name>Insights and Analytics</name>
|
27
|
+
<weight>14</weight>
|
28
|
+
</section>
|
29
|
+
</sections>
|
30
|
+
</exam>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<exam>
|
2
|
+
<title>Platform App Builder - Spring 2022</title>
|
3
|
+
|
4
|
+
<sections>
|
5
|
+
<section>
|
6
|
+
<name>Salesforce Fundamentals</name>
|
7
|
+
<weight>23</weight>
|
8
|
+
</section>
|
9
|
+
|
10
|
+
<section>
|
11
|
+
<name>Data Modeling and Management</name>
|
12
|
+
<weight>22</weight>
|
13
|
+
</section>
|
14
|
+
|
15
|
+
<section>
|
16
|
+
<name>Business Logic and Process Automation</name>
|
17
|
+
<weight>28</weight>
|
18
|
+
</section>
|
19
|
+
|
20
|
+
<section>
|
21
|
+
<name>User Interface</name>
|
22
|
+
<weight>17</weight>
|
23
|
+
</section>
|
24
|
+
|
25
|
+
<section>
|
26
|
+
<name>App Deployment</name>
|
27
|
+
<weight>10</weight>
|
28
|
+
</section>
|
29
|
+
</sections>
|
30
|
+
</exam>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<exam>
|
2
|
+
<title>Platform Developer I - Spring 2022</title>
|
3
|
+
|
4
|
+
<sections>
|
5
|
+
<section>
|
6
|
+
<name>Developer Fundamentals</name>
|
7
|
+
<weight>23</weight>
|
8
|
+
</section>
|
9
|
+
|
10
|
+
<section>
|
11
|
+
<name>Process Automation and Logic</name>
|
12
|
+
<weight>30</weight>
|
13
|
+
</section>
|
14
|
+
|
15
|
+
<section>
|
16
|
+
<name>User Interface</name>
|
17
|
+
<weight>25</weight>
|
18
|
+
</section>
|
19
|
+
|
20
|
+
<section>
|
21
|
+
<name>Testing, Debugging, and Deployment</name>
|
22
|
+
<weight>22</weight>
|
23
|
+
</section>
|
24
|
+
</sections>
|
25
|
+
</exam>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<exam>
|
2
|
+
<title>Platform Developer II - Spring 2022</title>
|
3
|
+
|
4
|
+
<sections>
|
5
|
+
<section>
|
6
|
+
<name>Advanced Developer Fundamentals</name>
|
7
|
+
<weight>18</weight>
|
8
|
+
</section>
|
9
|
+
|
10
|
+
<section>
|
11
|
+
<name>Process Automation, Logic, and Integration</name>
|
12
|
+
<weight>24</weight>
|
13
|
+
</section>
|
14
|
+
|
15
|
+
<section>
|
16
|
+
<name>User Interface</name>
|
17
|
+
<weight>20</weight>
|
18
|
+
</section>
|
19
|
+
|
20
|
+
<section>
|
21
|
+
<name>Testing, Debugging, and Deployment</name>
|
22
|
+
<weight>20</weight>
|
23
|
+
</section>
|
24
|
+
|
25
|
+
<section>
|
26
|
+
<name>Performance</name>
|
27
|
+
<weight>18</weight>
|
28
|
+
</section>
|
29
|
+
</sections>
|
30
|
+
</exam>
|
@@ -0,0 +1,55 @@
|
|
1
|
+
<exam>
|
2
|
+
<title>Sales Cloud Consultant - Spring 2022</title>
|
3
|
+
|
4
|
+
<sections>
|
5
|
+
<section>
|
6
|
+
<name>Sales Practices</name>
|
7
|
+
<weight>11</weight>
|
8
|
+
</section>
|
9
|
+
|
10
|
+
<section>
|
11
|
+
<name>Implementation Strategies</name>
|
12
|
+
<weight>13</weight>
|
13
|
+
</section>
|
14
|
+
|
15
|
+
<section>
|
16
|
+
<name>Application of Product Knowledge</name>
|
17
|
+
<weight>18</weight>
|
18
|
+
</section>
|
19
|
+
|
20
|
+
<section>
|
21
|
+
<name>Lead Management</name>
|
22
|
+
<weight>7</weight>
|
23
|
+
</section>
|
24
|
+
|
25
|
+
<section>
|
26
|
+
<name>Account and Contact Management</name>
|
27
|
+
<weight>11</weight>
|
28
|
+
</section>
|
29
|
+
|
30
|
+
<section>
|
31
|
+
<name>Opportunity Management</name>
|
32
|
+
<weight>10</weight>
|
33
|
+
</section>
|
34
|
+
|
35
|
+
<section>
|
36
|
+
<name>Sales Productivity and Integration</name>
|
37
|
+
<weight>8</weight>
|
38
|
+
</section>
|
39
|
+
|
40
|
+
<section>
|
41
|
+
<name>Consulting Practices</name>
|
42
|
+
<weight>7</weight>
|
43
|
+
</section>
|
44
|
+
|
45
|
+
<section>
|
46
|
+
<name>Sales Metrics, Reports, and Dashboards</name>
|
47
|
+
<weight>7</weight>
|
48
|
+
</section>
|
49
|
+
|
50
|
+
<section>
|
51
|
+
<name>Data Management</name>
|
52
|
+
<weight>8</weight>
|
53
|
+
</section>
|
54
|
+
</sections>
|
55
|
+
</exam>
|
@@ -0,0 +1,50 @@
|
|
1
|
+
<exam>
|
2
|
+
<title>Service Cloud Consultant - Spring 2022</title>
|
3
|
+
|
4
|
+
<sections>
|
5
|
+
<section>
|
6
|
+
<name>Industry Knowledge</name>
|
7
|
+
<weight>10</weight>
|
8
|
+
</section>
|
9
|
+
|
10
|
+
<section>
|
11
|
+
<name>Implementation Strategies</name>
|
12
|
+
<weight>15</weight>
|
13
|
+
</section>
|
14
|
+
|
15
|
+
<section>
|
16
|
+
<name>Service Cloud Solution Design</name>
|
17
|
+
<weight>16</weight>
|
18
|
+
</section>
|
19
|
+
|
20
|
+
<section>
|
21
|
+
<name>Knowledge Management</name>
|
22
|
+
<weight>9</weight>
|
23
|
+
</section>
|
24
|
+
|
25
|
+
<section>
|
26
|
+
<name>Interaction Channels</name>
|
27
|
+
<weight>10</weight>
|
28
|
+
</section>
|
29
|
+
|
30
|
+
<section>
|
31
|
+
<name>Case Management</name>
|
32
|
+
<weight>15</weight>
|
33
|
+
</section>
|
34
|
+
|
35
|
+
<section>
|
36
|
+
<name>Contact Center Analytics</name>
|
37
|
+
<weight>5</weight>
|
38
|
+
</section>
|
39
|
+
|
40
|
+
<section>
|
41
|
+
<name>Integration and Data Management</name>
|
42
|
+
<weight>5</weight>
|
43
|
+
</section>
|
44
|
+
|
45
|
+
<section>
|
46
|
+
<name>Service Console</name>
|
47
|
+
<weight>15</weight>
|
48
|
+
</section>
|
49
|
+
</sections>
|
50
|
+
</exam>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<exam>
|
2
|
+
<title>Sharing and Visibility Architect - Spring 2022</title>
|
3
|
+
|
4
|
+
<sections>
|
5
|
+
<section>
|
6
|
+
<name>Declarative Sharing</name>
|
7
|
+
<weight>76</weight>
|
8
|
+
</section>
|
9
|
+
|
10
|
+
<section>
|
11
|
+
<name>Performance and Scalability</name>
|
12
|
+
<weight>7</weight>
|
13
|
+
</section>
|
14
|
+
|
15
|
+
<section>
|
16
|
+
<name>Programmatic Sharing</name>
|
17
|
+
<weight>17</weight>
|
18
|
+
</section>
|
19
|
+
</sections>
|
20
|
+
</exam>
|
@@ -0,0 +1,63 @@
|
|
1
|
+
class SalesforceCertificationCalculator::Exam
|
2
|
+
SFC = SalesforceCertificationCalculator
|
3
|
+
|
4
|
+
# @!attribute title
|
5
|
+
# @return [String] name of the exam
|
6
|
+
#
|
7
|
+
# @!attribute file
|
8
|
+
# @return [String] path to file containing exam data
|
9
|
+
#
|
10
|
+
# @!attribute [r] sections
|
11
|
+
# @return [Array] collection of Section objects for all sections of the exam
|
12
|
+
#
|
13
|
+
# @!attribute [r] total
|
14
|
+
# @return [Number] cumulative score for the entire exam; if sections' weights do not sum to 100, it will return an error message as a string
|
15
|
+
attr_accessor :title, :file
|
16
|
+
attr_reader :sections, :total
|
17
|
+
|
18
|
+
# Creates Exam object
|
19
|
+
#
|
20
|
+
# @example Create Exam Object
|
21
|
+
# >> my_exam = Exam.new
|
22
|
+
def initialize
|
23
|
+
@title = ""
|
24
|
+
@file = ""
|
25
|
+
@sections = []
|
26
|
+
@total = 0
|
27
|
+
end
|
28
|
+
|
29
|
+
# Adds a new Section object to the exam's array of sections
|
30
|
+
#
|
31
|
+
# @example Add New Section
|
32
|
+
# >> my_exam = Exam.new
|
33
|
+
# >> my_exam.add_section('Database', 24)
|
34
|
+
#
|
35
|
+
# @param name [String] title of the section
|
36
|
+
# @param weight [Number] percentage weight of the section, expressed as an integer
|
37
|
+
# @param score [Number] individual's percentage score on that section of the exam, expressed as an integer; uses 0 as default value
|
38
|
+
def add_section(name, weight, score = 0)
|
39
|
+
section = SFC::Section.new(name, weight, score)
|
40
|
+
@sections.push(section)
|
41
|
+
end
|
42
|
+
|
43
|
+
# Determines cumulative score for the exam based on its sections' weights and scores
|
44
|
+
#
|
45
|
+
# @example Calculate Total
|
46
|
+
# >> my_exam = Exam.new
|
47
|
+
# >> my_exam.calculate_total
|
48
|
+
def calculate_total
|
49
|
+
summed_weights = 0
|
50
|
+
|
51
|
+
@sections.each do |section|
|
52
|
+
summed_weights += section.weight
|
53
|
+
@total += section.weight * section.score / 100.0
|
54
|
+
end
|
55
|
+
|
56
|
+
# Sets total to error message when sum of sections' weights is not 100
|
57
|
+
if summed_weights != 100
|
58
|
+
@total = "CANNOT CALCULATE"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
require "salesforce_certification_calculator/section"
|
@@ -0,0 +1,53 @@
|
|
1
|
+
class SalesforceCertificationCalculator::FileReader
|
2
|
+
SFC = SalesforceCertificationCalculator
|
3
|
+
|
4
|
+
# Gets list of all exams in the database, including their names and file paths
|
5
|
+
#
|
6
|
+
# @example Retrieve Exams
|
7
|
+
# >> reader = FileReader.new
|
8
|
+
# >> exams = reader.generate_exams_list
|
9
|
+
# => [<SalesforceCertificationCalculator::Exam 0x000987>, <SalesforceCertificationCalculator::Exam 0x000988>]
|
10
|
+
#
|
11
|
+
# @return [Array] collection of Exam objects
|
12
|
+
def generate_exams_list
|
13
|
+
exams = []
|
14
|
+
files = Dir.glob("data/*xml")
|
15
|
+
|
16
|
+
files.each do |file|
|
17
|
+
exam = SFC::Exam.new
|
18
|
+
doc = File.open(file) { |f| Nokogiri::XML(f) }
|
19
|
+
title = doc.at_xpath("//title")
|
20
|
+
exam.title = title.content
|
21
|
+
exam.file = file
|
22
|
+
exams.push(exam)
|
23
|
+
end
|
24
|
+
|
25
|
+
return exams
|
26
|
+
end
|
27
|
+
|
28
|
+
# Gets all details about an exam's sections, including names and weights
|
29
|
+
#
|
30
|
+
# @example Retrieve Exam Data
|
31
|
+
# >> reader = FileReader.new
|
32
|
+
# >> exams = FileReader.generate_exams_list
|
33
|
+
# >> exam = reader.extract_exam_data(exams[0])
|
34
|
+
# => <SalesforceCertificationCalculator::Exam 0x000987>
|
35
|
+
#
|
36
|
+
# @param exam [Exam] object, containing name and file properties, to use to get full data
|
37
|
+
#
|
38
|
+
# @return [Exam] object with not only name and file, but also all sections, with their names and weights
|
39
|
+
def extract_initial_exam_data(exam)
|
40
|
+
doc = File.open(exam.file) { |f| Nokogiri::XML(f) }
|
41
|
+
names = doc.xpath("//name")
|
42
|
+
weights = doc.xpath("//weight")
|
43
|
+
|
44
|
+
(0..names.length-1).each do |i|
|
45
|
+
exam.add_section(names[i].content, weights[i].content.to_i)
|
46
|
+
end
|
47
|
+
|
48
|
+
return exam
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
require "nokogiri"
|
53
|
+
require "salesforce_certification_calculator/exam"
|
@@ -0,0 +1,25 @@
|
|
1
|
+
class SalesforceCertificationCalculator::Section
|
2
|
+
# @!attribute name
|
3
|
+
# @return [String] name of the section
|
4
|
+
#
|
5
|
+
# @!attribute weight
|
6
|
+
# @return [Number] percentage indicating how much the section is worth to the total score, represented as an integer
|
7
|
+
#
|
8
|
+
# @!attribute score
|
9
|
+
# @return [Number] individual's score on the specific section, represented as an integer
|
10
|
+
attr_accessor :name, :weight, :score
|
11
|
+
|
12
|
+
# Creates Section object
|
13
|
+
#
|
14
|
+
# @example Create Section Object
|
15
|
+
# >> my_section = Section.new('Database', 24, 85)
|
16
|
+
#
|
17
|
+
# @param name [String] name of the section
|
18
|
+
# @param weight [Number] percentage indicating how much the section is worth to the total score, represented as an integer
|
19
|
+
# @param score [Number] individual's score on the specific section, represented as an integer
|
20
|
+
def initialize(name, weight, score)
|
21
|
+
@name = name
|
22
|
+
@weight = weight
|
23
|
+
@score = score
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,107 @@
|
|
1
|
+
class SalesforceCertificationCalculator::UI
|
2
|
+
SFC = SalesforceCertificationCalculator
|
3
|
+
|
4
|
+
# Allows user to select between viewing a list of all existing exams or inputting all data manually
|
5
|
+
#
|
6
|
+
# @example Make Choice
|
7
|
+
# >> ui = UI.new
|
8
|
+
# >> choice = ui.select_list_or_new
|
9
|
+
# => 'LIST'
|
10
|
+
#
|
11
|
+
# @return [String] 'LIST' to indicate user wants to see a list of all existing exams; 'NEW' to indicate user wants to input all data manually
|
12
|
+
def select_list_or_new
|
13
|
+
puts "Do you want to select an exam from a list (enter LIST), or do you want to type in your own details (enter NEW)?"
|
14
|
+
choice = gets.chomp
|
15
|
+
|
16
|
+
if choice == "LIST" || choice == "NEW"
|
17
|
+
return choice
|
18
|
+
else
|
19
|
+
select_list_or_new()
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
# Allows user to select which exam from the list of existing exams to use
|
24
|
+
#
|
25
|
+
# @example Select a Specific Exam
|
26
|
+
# >> ui = UI.new
|
27
|
+
# >> reader = FileReader.new
|
28
|
+
# >> exams = reader.generate_exams_list
|
29
|
+
# >> exam = ui.select_specific_exam(exams)
|
30
|
+
# => <SalesforceCertificationCalculator::Exam 0x000987>
|
31
|
+
#
|
32
|
+
# @param exams [Array] collection of Exam objects to use for selection
|
33
|
+
#
|
34
|
+
# @return [Exam] object with name, file, and section details for selected exam
|
35
|
+
def select_specific_exam(exams)
|
36
|
+
puts "Your choices are:"
|
37
|
+
|
38
|
+
exams.each do |exam|
|
39
|
+
puts "#{exams.find_index(exam) + 1} - #{exam.title}"
|
40
|
+
end
|
41
|
+
|
42
|
+
puts "Which one would you like to select? Enter the number before the exam name:"
|
43
|
+
choice = gets.chomp.to_i
|
44
|
+
|
45
|
+
if choice.between?(1, exams.length)
|
46
|
+
return exams[choice - 1]
|
47
|
+
else
|
48
|
+
select_specific_exam(exams)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
# Allows user to input their scores for each section
|
53
|
+
#
|
54
|
+
# @example Enter Scores
|
55
|
+
# >> ui = UI.new
|
56
|
+
# >> reader = FileReader.new
|
57
|
+
# >> exams = reader.generate_exams_list
|
58
|
+
# >> exam = ui.select_specific_exam(exams)
|
59
|
+
# >> updated_exam = ui.provide_scores(exam)
|
60
|
+
# => <SalesforceCertificationCalculator::Exam 0x000987>
|
61
|
+
#
|
62
|
+
# @param exam [Exam] object with name, file, and section details
|
63
|
+
#
|
64
|
+
# @return [Exam] object with name, file, and section details, updated with the individual scores for each section
|
65
|
+
def provide_scores(exam)
|
66
|
+
sections = exam.sections
|
67
|
+
|
68
|
+
sections.each do |section|
|
69
|
+
puts "#{section.name} is worth #{section.weight}%"
|
70
|
+
puts "What score did you get on that section? (enter an integer)"
|
71
|
+
score = gets.chomp.to_i
|
72
|
+
section.score = score
|
73
|
+
end
|
74
|
+
|
75
|
+
return exam
|
76
|
+
end
|
77
|
+
|
78
|
+
# Allows user to provide all exam data manually
|
79
|
+
#
|
80
|
+
# @example Input Information
|
81
|
+
# >> ui = UI.new
|
82
|
+
# >> exam = ui.provide_all_details_manually
|
83
|
+
# => <SalesforceCertificationCalculator::Exam 0x000987>
|
84
|
+
#
|
85
|
+
# @return [Exam] object with name, file, and section details, including scores for each section
|
86
|
+
def provide_all_details_manually
|
87
|
+
exam = SFC::Exam.new
|
88
|
+
puts "What is the title of this exam?"
|
89
|
+
exam.title = gets.chomp
|
90
|
+
puts "How many sections does it have?"
|
91
|
+
length = gets.chomp.to_i
|
92
|
+
|
93
|
+
(1..length).each do |i|
|
94
|
+
puts "What is the name of Section #{i}?"
|
95
|
+
name = gets.chomp
|
96
|
+
puts "How many percentage points is Section #{i} worth?"
|
97
|
+
weight = gets.chomp.to_i
|
98
|
+
puts "What score did you get on Section #{i}?"
|
99
|
+
score = gets.chomp.to_i
|
100
|
+
exam.add_section(name, weight, score)
|
101
|
+
end
|
102
|
+
|
103
|
+
return exam
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
require "salesforce_certification_calculator/exam"
|
@@ -0,0 +1,92 @@
|
|
1
|
+
class SalesforceCertificationCalculator
|
2
|
+
# @!attribute exam
|
3
|
+
# @return [Exam] object being used for calculations
|
4
|
+
#
|
5
|
+
# @!attribute [r] exams
|
6
|
+
# @return [Array] collection of Exam objects used for temporary storage
|
7
|
+
attr_accessor :exam
|
8
|
+
attr_reader :exams
|
9
|
+
|
10
|
+
# Creates SalesforceCertificationCalculator object
|
11
|
+
#
|
12
|
+
# @example Create Calculator Object
|
13
|
+
# >> calculator = SalesforceCertificationCalculator.new
|
14
|
+
def initialize
|
15
|
+
@exams = []
|
16
|
+
@exam = Exam.new
|
17
|
+
@reader = FileReader.new
|
18
|
+
@ui = UI.new
|
19
|
+
end
|
20
|
+
|
21
|
+
# Gets list of all exams in the database, including their names and file paths; shortcut for FileReader method to modify exams attribute on object
|
22
|
+
#
|
23
|
+
# @example Retrieve Exams
|
24
|
+
# >> calculator = SalesforceCertificationCalculator.new
|
25
|
+
# >> exams = calculator.generate_exams_list
|
26
|
+
# => [<SalesforceCertificationCalculator::Exam 0x000987>, <SalesforceCertificationCalculator::Exam 0x000988>]
|
27
|
+
def generate_exams_list
|
28
|
+
@exams = @reader.generate_exams_list
|
29
|
+
end
|
30
|
+
|
31
|
+
# Gets all details about an exam's sections, including names and weights; shortcut for FileReader method to modify exam attribute on object
|
32
|
+
#
|
33
|
+
# @example Retrieve Exam Data
|
34
|
+
# >> calculator = SalesforceCertificationCalculator.new
|
35
|
+
# >> exams = calculator.generate_exams_list
|
36
|
+
# >> exam = calculator.extract_exam_data(exams[0])
|
37
|
+
# => <SalesforceCertificationCalculator::Exam 0x000987>
|
38
|
+
#
|
39
|
+
# @param exam [Exam] object, containing name and file properties, to use to get full data
|
40
|
+
def extract_initial_exam_data
|
41
|
+
@exam = @reader.extract_initial_exam_data(@exam)
|
42
|
+
end
|
43
|
+
|
44
|
+
# Determines cumulative score for the exam based on its sections' weights and scores; shortcut for Exam method that returns total value of exam after calculating total
|
45
|
+
#
|
46
|
+
# @example Calculate Total
|
47
|
+
# >> calculator = SalesforceCertificationCalculator.new
|
48
|
+
# >> total = calculator.calculate_total
|
49
|
+
# => 87
|
50
|
+
#
|
51
|
+
# @return [Number] cumulative score on exam; if sections' weights do not sum to 100, it will return an error message as a string
|
52
|
+
def calculate_total
|
53
|
+
@exam.calculate_total
|
54
|
+
|
55
|
+
return @exam.total
|
56
|
+
end
|
57
|
+
|
58
|
+
# Determines cumulative score manually; shortcut that combines all of UI's methods
|
59
|
+
#
|
60
|
+
# @example Calculate Total
|
61
|
+
# >> calculator = SalesforceCertificationCalculator.new
|
62
|
+
# >> total = calculator.determine_percentage_manually
|
63
|
+
# => 87
|
64
|
+
#
|
65
|
+
# @return [Number] cumulative score on exam
|
66
|
+
def determine_percentage_manually
|
67
|
+
choice = @ui.select_list_or_new
|
68
|
+
|
69
|
+
if choice == "LIST"
|
70
|
+
@exams = @reader.generate_exams_list
|
71
|
+
@exam = @ui.select_specific_exam(@exams)
|
72
|
+
@exam = @reader.extract_initial_exam_data(@exam)
|
73
|
+
|
74
|
+
puts "You selected: #{@exam.title}"
|
75
|
+
puts "Enter your scores for each of the exam's #{@exam.sections.length} sections in the order you are prompted"
|
76
|
+
|
77
|
+
@exam = @ui.provide_scores(@exam)
|
78
|
+
else
|
79
|
+
@exam = @ui.provide_all_details_manually
|
80
|
+
end
|
81
|
+
|
82
|
+
@exam.calculate_total
|
83
|
+
|
84
|
+
puts "Your cumulative score is: #{@exam.total}%"
|
85
|
+
|
86
|
+
return @exam.total
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
require "salesforce_certification_calculator/exam"
|
91
|
+
require "salesforce_certification_calculator/u_i"
|
92
|
+
require "salesforce_certification_calculator/file_reader"
|