-
Notifications
You must be signed in to change notification settings - Fork 24
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
Added Functionality #3
base: main
Are you sure you want to change the base?
Conversation
@@ -21,13 +24,35 @@ fun main() { | |||
} | |||
|
|||
fun readResponses(): List<Response> { | |||
TODO() | |||
var returnList = mutableListOf<Response>() | |||
val sc = Scanner(File("responses.txt")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file path is complete. This won't read the file present inside the assignment
directory.
returnList = returnList.filterNot { it.covidPositive }.toMutableList() | ||
returnList.sortWith(compareBy<Response> {it.branch}.thenBy {it.name}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be part of the processResponses
function. readResponses()
is just for reading the data only.
TODO() | ||
fun processResponses(responses: List<Response>): List<List<Response>> { | ||
|
||
return responses.groupBy {it.branch}.values.toList().withIndex().groupBy { it.index / 3 }.map { it.value.flatMap { it.value } } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part could have been done very easily using the chunked
function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work 👍 . Left some small suggestions.
Approving it as the code is correct.
No description provided.