-
Notifications
You must be signed in to change notification settings - Fork 0
fb exercise solved #2
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
base: develop
Are you sure you want to change the base?
Conversation
test/exercise/fp/solution.rb
Outdated
| def film_multicountry?(film) | ||
| return false if film['country'].nil? | ||
|
|
||
| film['country'].include?(',') |
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.
запятая конечно на тоненького, по хорошему должно быть упоминание про две страны и больше
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.
я что-то не могу придумать как проверить количество стран без запятой, там же просто строка возвращается при обращении, а не коллекция у которой можно узнать размер
можно конечно засплитить строку в массив, по запятой, но это разве не то же самое по сути?
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.
не тоже самое, include просто запятую проверяет (как будто нам только запятая важно), а сплит хотя бы семантику количества добавит
test/exercise/fp/solution.rb
Outdated
|
|
||
| def rating(array) | ||
| multicountry_rated_films = [] | ||
| array.map { |film| multicountry_rated_films << film if film_rated?(film) && film_multicountry?(film) } |
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.
используешь мап и мутации, мап новый массив возвращает. И т.к. у тебя здесь по сути фильтрация, то функцию фильтрации и нужно использовать
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.
функция фильтрации это select? просто в задании сказано использовать map и reduce
или ты имел ввиду что-то такое?
multicountry_rated_films = array.filter_map { |film| film if film_rated?(film) && film_multicountry?(film) }
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.
селект или фильтр мап пойдет
test/exercise/fp/solution.rb
Outdated
| 0 | ||
| def chars_count(films, threshold) | ||
| top_rated_films = [] | ||
| films.map { |film| top_rated_films << film if raiting_of_film(film) > threshold } |
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.
здесь тоже самое про фильтрацию и мутацию
test/exercise/fp/solution.rb
Outdated
| 0 | ||
| def chars_count(films, threshold) | ||
| top_rated_films = [] | ||
| films.map { |film| top_rated_films << film if raiting_of_film(film) > threshold } |
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.
и еще здесь абстрация raiting_of_film протекла, она должна полностью и ответить подходит фильм для посчета или нет
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.
а когда переделаю новый PR делать или сделать новый коммит и написать тут об этом?
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.
в эту же ветку пуш
No description provided.