Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sebastian Mckee #625

Open
wants to merge 98 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
60a2392
Add initialize method
0nehundr3d Dec 3, 2024
d372891
Add question attribute
0nehundr3d Dec 3, 2024
fba2c01
Add answer attribute
0nehundr3d Dec 3, 2024
3ebc2c5
Add category attribute
0nehundr3d Dec 3, 2024
07c3cce
Initial Commit
0nehundr3d Dec 3, 2024
9f20c2c
Create class skeleton
0nehundr3d Dec 3, 2024
4d7d592
Add require rspec to fall in line with codebase
0nehundr3d Dec 3, 2024
5e6b02d
Add turn exists test
0nehundr3d Dec 3, 2024
1d65cb7
Change card method to attr_reader
0nehundr3d Dec 3, 2024
fc0aa98
Add has a card test
0nehundr3d Dec 3, 2024
8396e07
Change guess method to attr_reader
0nehundr3d Dec 3, 2024
bf42bce
Add guess and correct? tests
0nehundr3d Dec 3, 2024
31c86ff
Add correct? method
0nehundr3d Dec 3, 2024
49359b1
Add feedback test
0nehundr3d Dec 3, 2024
b9f1bf7
Add feedback method
0nehundr3d Dec 3, 2024
972fa49
Add false test to correct? method
0nehundr3d Dec 3, 2024
e2e53b3
Add negative feedback test
0nehundr3d Dec 3, 2024
1ae19b8
Change feedback method to work with incorrect answer
0nehundr3d Dec 3, 2024
39f9dfc
Initial Commit
0nehundr3d Dec 3, 2024
34b169b
Add Deck exists test
0nehundr3d Dec 3, 2024
09e2f7c
Create Deck class
0nehundr3d Dec 3, 2024
eef2970
Add has cards test
0nehundr3d Dec 3, 2024
a1ec5a3
Add cards attribute
0nehundr3d Dec 3, 2024
c49daa3
Update exists test for new Deck args
0nehundr3d Dec 3, 2024
2b2c06e
Add card count test
0nehundr3d Dec 3, 2024
b1a6b16
Add count method
0nehundr3d Dec 3, 2024
727126a
Add cards_in_category test
0nehundr3d Dec 4, 2024
5e541b6
Add cards_in_category method
0nehundr3d Dec 4, 2024
8395668
Initial Commit
0nehundr3d Dec 4, 2024
90ef4cb
Add Round exists test
0nehundr3d Dec 4, 2024
b198159
Add Round class
0nehundr3d Dec 4, 2024
014e2c5
Change exists tag to require deck arg
0nehundr3d Dec 4, 2024
f5245aa
Add deck arg to class
0nehundr3d Dec 4, 2024
009dca7
Add has a deck test
0nehundr3d Dec 4, 2024
6db407c
Add has turns test
0nehundr3d Dec 4, 2024
972124a
Fix checking deck instead of rounds
0nehundr3d Dec 4, 2024
7d85bf9
Add turns array
0nehundr3d Dec 4, 2024
20da7fa
Add current_card test
0nehundr3d Dec 4, 2024
a9db798
Add current_card method
0nehundr3d Dec 4, 2024
9ea9fdc
Add can create turns test
0nehundr3d Dec 4, 2024
36850c2
Add take_turn method
0nehundr3d Dec 4, 2024
986a417
Add can create valid turns test
0nehundr3d Dec 4, 2024
51881b3
Fix args being givin in wrong order in take_turn method
0nehundr3d Dec 4, 2024
3597345
Make take_turn params more clear
0nehundr3d Dec 4, 2024
404f930
Add stores previous turns test
0nehundr3d Dec 4, 2024
f176830
Change take_turn method to store turns
0nehundr3d Dec 4, 2024
13960b5
Add can track number of correct answers test
0nehundr3d Dec 4, 2024
2c3eac0
Add number_correct attribute and increment functionality
0nehundr3d Dec 4, 2024
28a81f4
Change take_turn method to cycle through deck
0nehundr3d Dec 4, 2024
2257abd
Add can cycle through deck test
0nehundr3d Dec 4, 2024
2b7e90c
Add stores all previous taken turns test
0nehundr3d Dec 4, 2024
ca28076
Update stores all previous taken turns to be more robust
0nehundr3d Dec 4, 2024
721c3b8
Add number_correct test to stores all previous taken turns in order test
0nehundr3d Dec 4, 2024
6ee0b68
Add correct by category test
0nehundr3d Dec 4, 2024
3ef018d
Fix bugs causing number by category test to always fail
0nehundr3d Dec 4, 2024
2226e5f
Add number_correct_by_category method
0nehundr3d Dec 4, 2024
817a382
Add percent correct test
0nehundr3d Dec 4, 2024
953c4ee
Add percent_correct method
0nehundr3d Dec 4, 2024
9ba014d
add perceny by category test
0nehundr3d Dec 4, 2024
a451e1f
Add percent_correct_by_category method
0nehundr3d Dec 4, 2024
452ecb9
Initial Commit
0nehundr3d Dec 4, 2024
e7e5eec
Add categories attribute test
0nehundr3d Dec 4, 2024
c47a927
Add categories attribute
0nehundr3d Dec 4, 2024
4fe65c0
Remove redundant code in percent_correct_by_category
0nehundr3d Dec 4, 2024
56773a1
Change percent methods to round to the second decimal place
0nehundr3d Dec 4, 2024
3a98e9b
Add start function that runs flashcard game
0nehundr3d Dec 4, 2024
bcb9443
Change for loops to each loops for readability and removal of unneede…
0nehundr3d Dec 4, 2024
3f90bbd
Change for loops to each loops and change unclear temp variables
0nehundr3d Dec 4, 2024
9fd36af
Change @count attribute to be static
0nehundr3d Dec 4, 2024
9e8b7bb
Change runner file to utilize updated deck.count method
0nehundr3d Dec 4, 2024
77fdd33
Add documentation to less clear blocks of code
0nehundr3d Dec 4, 2024
8d6a721
Add documentation and line breaks for code readability
0nehundr3d Dec 4, 2024
3f3408a
Initial Commit
0nehundr3d Dec 4, 2024
7043327
Add CardGenerator exists test
0nehundr3d Dec 4, 2024
ab5edec
Create CardGenerator class
0nehundr3d Dec 4, 2024
8d6743b
Initial Commit
0nehundr3d Dec 4, 2024
e29ed72
Add generate cards test
0nehundr3d Dec 4, 2024
df31524
Add cards to be generated
0nehundr3d Dec 4, 2024
7295c43
Fix typo in card 4 category
0nehundr3d Dec 4, 2024
fcde3e3
Change initialize method to generate cards list
0nehundr3d Dec 4, 2024
c237a33
Change runner file to use CardGenerator class
0nehundr3d Dec 4, 2024
65f7ad2
Change .each to .find_all in cards_in_category
0nehundr3d Dec 5, 2024
9a9ef2e
Change each loop to find loop in percent_correct method
0nehundr3d Dec 5, 2024
c614310
Refractor percent_correct_by_category into two .find_all statements
0nehundr3d Dec 5, 2024
7802181
Refractor number_correct_by_category into one .find_all statement
0nehundr3d Dec 5, 2024
c7b5331
Clean up code in take_turn method
0nehundr3d Dec 5, 2024
71a494e
Change turn class to be case insensitive
0nehundr3d Dec 5, 2024
fcbe73c
Add missing % in score readout
0nehundr3d Dec 5, 2024
686ced8
change each loop to times loop
0nehundr3d Dec 6, 2024
f3c927b
Remove redundant variable
0nehundr3d Dec 6, 2024
7b8b38e
Refractor @categories initialazation into one line
0nehundr3d Dec 6, 2024
43b72ec
Refractor feedback into one line
0nehundr3d Dec 6, 2024
c984c1b
Add documentation mode to spec files
0nehundr3d Dec 6, 2024
69b4001
Remove redundent config settings
0nehundr3d Dec 6, 2024
e2e3a77
Change take_turn to no longer delete cards in array
0nehundr3d Dec 8, 2024
64b0055
Remove unneeded parens
0nehundr3d Dec 8, 2024
cbc6e72
Initial Commit
0nehundr3d Dec 10, 2024
e4fccbf
Change card generator spec to use seperate test text file
0nehundr3d Dec 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Change percent methods to round to the second decimal place
  • Loading branch information
0nehundr3d committed Dec 4, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 56773a1b2b2a5bb6631b3e855995ba1d14f9a146
6 changes: 3 additions & 3 deletions lib/round.rb
Original file line number Diff line number Diff line change
@@ -43,17 +43,17 @@ def percent_correct
correct += 1
end
end
(correct/turns.size) * 100
((correct/turns.size) * 100).round(2)
end

def percent_correct_by_category(category)
correct = number_correct_by_category(category)
correct = number_correct_by_category(category).to_f
turns = []
for turn in @turns
if turn.card.category == category
turns << turn
end
end
(correct/turns.length) * 100
((correct/turns.length) * 100).round(2)
end
end