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 - Cathy #24

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

Space - Cathy #24

wants to merge 1 commit into from

Conversation

cojenco
Copy link

@cojenco cojenco commented Feb 10, 2020

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? At first I nested my data according to rides, similar to the raw data. I tested the structure just with 4 sample rides. While I was structuring my thinking flow and code blocks, I realized that given the questions asked. It would make much more sense to structure the data according to drivers. I then compared for each layer whether it would make more sense to be ordered in an array or paired in a hash. My data structure continued to evolve till this current version.
What was your strategy for going through the data structure and gathering information? My first step was to understand the raw data and list out the key factors. Then I reviewed all the questions we wanted to answer. Given those information, then I started to think/try/error how the layers of data should be set up. Instead of all 11 rides of data, my initial tests just used 4 rides of data for simplicity. Until I was comfortable with the data structure, then I inputed all 11 rides.
What was an example of something that was necessary to store in a variable? Why was it necessary, useful, or helpful? For my code, I integrated many small loops/ methods into a single method, and my return value was a new array of hash. Thus it was very important for me to set a variable when I called for that method. It was therefore helpful to retrieve different pieces of data from that variable.
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 times and each for iterations. For questions 4 and 5, I used enumerable to help determine max values. Before I integrated multiple methods, for each small method replacing iterators by using the ".map" enumerable would simplify the code.
Were some calculations easier than others? Why? Question 1 was the easiest because it would only require information from the second layer, and nothing further deeper. For the optional question, it required grouping information from the deepest layer. Complication intensifies when we have to loop through more and more layers.

@dHelmgren
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 ✔️

Functional Requirements

Functional Requirement yes/no
To the terminal, the program outputs the correct number of rides each driver has given ✔️
... 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 ✔️
Yellow (Approaches Standards) 2-3 in Code Review && 2+ in Functional Requirements
Red (Not at Standard) 0,1 in Code Review or 0,1 in Functional Reqs, or assignment is breaking/doesn’t run with less than 5 minutes of debugging

Code Style Bonus Awards

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

Quality Yes?
Concise
Logical/Organized

@@ -0,0 +1,147 @@
# create drivers {hash} as a single variable data structure

Choose a reason for hiding this comment

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

Hey, small thing, but the name of this file made things tricky!

you named the file using spaces, which meant I couldn't easily run it from the command line, and you also forgot to make the file type .rb. Not a huge deal, and might not come up again, but I figure it's good to know.

end

# create a method to sum up money made each day per driver and get the date they made the most money
def get_max_money_date(array_entered)

Choose a reason for hiding this comment

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

Really nice use of methods!

Comment on lines +130 to +142
organized_data.length.times do |i|
puts "Driver #{organized_data[i][:driver_id]} has given a total of #{organized_data[i][:total_rides]} rides"
puts "Driver #{organized_data[i][:driver_id]} has made a total of $#{organized_data[i][:total_money]}"
puts "Driver #{organized_data[i][:driver_id]} has an average rating of #{organized_data[i][:avg_rating]}"
end

# find which driver made the most money using an enumerable and generate result
max_money = organized_data.max_by{|each_hash| each_hash[:total_money]}
puts "The driver that made the most money with $#{max_money[:total_money]} is #{max_money[:driver_id]}"

# find which driver had highest rating using an enumerable and generate result
max_rating = organized_data.max_by{|each_hash| each_hash[:avg_rating]}
puts "The driver that has the highest average rating of #{max_rating[:avg_rating]} is #{max_rating[:driver_id]}"

Choose a reason for hiding this comment

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

This section is clear, concise and I love it!

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