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

Space - Katie #39

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Space - Katie #39

wants to merge 1 commit into from

Conversation

ktvoort123
Copy link

Assignment Submission: Ride Share

Congratulations! You're submitting your assignment. Please reflect on the assignment with these questions.

Reflection

Question Answer
What did your data structure look like at first? Did this structure evolve over time? Why? My data structure initially was organized by ride. In my code, I created loops to organize that data in a new hash of hashes, where each hash held data on one driver.
What was your strategy for going through the data structure and gathering information? My strategy for going through the data structure and gathering information was to create a new hash to store data for each driver, rather than organized by ride.
What was an example of something that was necessary to store in a variable? Why was it necessary, useful, or helpful? An example of something I had to store in a variable was the highest amount of money made (highest_amt_money_made). I had to store this in a variable, because when I looped over the drivers hash, I needed to know what was the highest amount of money made so that I could compare it to that driver's amount of money made, and then update it if that driver made more money than the current value of highest_amt_money_made.
What kinds of iteration did you use? Did you use .map? If so, when? If not, why, or when would be a good opportunity to use it? I used .each to iterate through my arrays and hashes. I did not use .map because I needed to convert my data from an array to a hash, but .map converts from an array to an array.
Were some calculations easier than others? Why? Yes, finding the driver's average rating was harder than finding the drivers total amount of money made. This is because the total amount that the driver made simply needed to be added together each time it went through the rides array. However, the average rating depends on the amount of rides the driver has made, which cannot be calculated like that. To remedy this, I created a key value pair in each driver's hash for the number of rides given and the total ratings number, and then later on, once the drivers hash was completed, I calculated the average rating and added that as a new key value pair for each driver.

@CheezItMan
Copy link

Ride Share

Major Learning Goals/Code Review

Criteria yes/no, and optionally any details/lines of code to reference
Correctly creates, reads, and modifies variables ✔️
Correctly creates and accesses arrays ✔️
Correctly creates and accesses hashes ✔️
Reasonably organizes large amounts of related data into nested arrays and hashes ✔️
Correctly iterates through a nested data structure using loops and/or Enumerable methods ✔️
Reasonably organizes small pieces of code into methods, and calls/invokes those methods ✔️, it works, but see my inline comments.

Functional Requirements

Functional Requirement yes/no
To the terminal, the program outputs the correct number of rides each driver has given ✔️, however it doesn't look very end-user friendly. The output looks more like a hash.
... outputs the total amount of money each driver has made ✔️
... outputs the average rating for each driver ✔️
... outputs which driver made the most money ✔️
... outputs which driver has the highest average rating ✔️

Overall Feedback

Overall Feedback Criteria yes/no
Green (Meets/Exceeds Standards) 4+ in Code Review && 3+ in Functional Requirements ✔️

Code Style Bonus Awards

Was the code particularly impressive in code style for any of these reasons (or more...?)

Quality Yes?
Perfect Indentation
Elegant/Clever
Descriptive/Readable
Concise

end

# ride information copied from the rides.csv file, organized as an array of hashes, where each hash represents one ride
rides = [

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this structure!

@@ -0,0 +1,138 @@
# a method to add a driver to the driver hash
def add_driver_to_hash(ride_hash, drivers_hash)
drivers_hash[ride_hash[:driver_id]] = {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So any driver you add this this won't have any rides listed, but will have a cost and total of ratings?

# initiliaze the new drivers hash where information per driver will be stored
drivers = {}

# loop through the rides array of hashes

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of these segments could be broken into methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants