-
Notifications
You must be signed in to change notification settings - Fork 0
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
task4 #6
base: master
Are you sure you want to change the base?
Conversation
UI/script.js
Outdated
return result; | ||
} | ||
|
||
function filterHashtag(photoPosts, hashtag) { |
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.
UI/script.js
Outdated
} | ||
|
||
function getPhotoPost(id) { | ||
for (var item in photoPosts) { |
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.
UI/script.js
Outdated
return result; | ||
} | ||
|
||
function getPhotoPosts(skip, top, filterConfig) { |
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.
где значения по умолчанию ?
UI/script.js
Outdated
if (filterConfig === undefined) { | ||
return photoPosts.sort(compareDate).slice(skip, skip + top); | ||
} else { | ||
resultArray = photoPosts.sort(compareDate).slice(skip, skip + top); |
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.
что-то мне подсказывает, что это надо делать после фильтров
UI/script.js
Outdated
|| photoPost.hashTag.length === 0 || photoPost.like.length === 0) { | ||
return false; | ||
} | ||
for (var item in photoPost.hashTag) { |
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.
смотри, это как минимум не item а index
for .. in впринципе лучше не использовать
есть обычный for, forEach, for .. of
UI/script.js
Outdated
} | ||
|
||
function editPhotoPost(id, objectPhotoPost) { | ||
if (validatePhotoPost(objectPhotoPost)) { |
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.
лучше пересмотри эту фуннкцию на паре
UI/script.js
Outdated
if (!objectPhotoPost) { | ||
return false; | ||
} | ||
if (id === undefined) { |
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.
где-то я уже это видел
UI/script.js
Outdated
removePhotoPost('4'); | ||
editPhotoPost('1', {hashTag: ['#hashtag_1', '#hashtag_8']}); | ||
getPhotoPost('1'); | ||
} |
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.
а как использовать этот модуль ?
UI/script.js
Outdated
return false; | ||
} | ||
|
||
console.log(getPhotoPosts(0, 10)); |
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.
ттесыт должны быть во вне
if (!objectPhotoPost) { | ||
return false; | ||
} | ||
if (id === undefined || typeof id !== 'string') { |
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.
typeof id !== 'string' этого будет достаточно
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.
Уже аутдейтед многое но на всякий.
UI/index.html
Outdated
<link rel="stylesheet" href="style.css"> | ||
</head> | ||
<body> | ||
<script src="script.js"></script> |
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.
Не внимательно слушала Яну на лекции:
Типичная ошибка №1:
См внимательно: https://learn.javascript.ru/external-script
UI/script.js
Outdated
}]; | ||
|
||
function compareDate(a, b) { | ||
return (a.createdAt) - (b.createdAt); |
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.
откуда опять копипастим чужие неточности ? (вопрос риторический, я уже видел откуда)
Скобки не нужны.
UI/script.js
Outdated
return (a.createdAt) - (b.createdAt); | ||
} | ||
|
||
function filterAuthor(photoPosts, author) { |
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.
почему findByAuthor называется (дословно "отфильтровать авторов")
UI/script.js
Outdated
} | ||
|
||
function filterAuthor(photoPosts, author) { | ||
var result = []; |
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.
UI/script.js
Outdated
return result; | ||
} | ||
|
||
function filterHashtag(photoPosts, hashtag) { |
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.
Оба замечания выше
UI/script.js
Outdated
return true; | ||
} | ||
function removePhotoPost(id) { | ||
for (var i in photoPosts) { |
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.
https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex
и будут всего 3 понятные строчки...
return false; | ||
} | ||
|
||
function editPhotoPost(id, objectPhotoPost) { |
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.
Логика не соответствует той которая прописана в задании.
UI/script.js
Outdated
like: ['author21'] | ||
}); | ||
removePhotoPost('4'); | ||
editPhotoPost('1', {hashTag: ['#hashtag_1', '#hashtag_8']}); |
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.
А вот и не работает оно так :)
UI/index.html
Outdated
</div> | ||
</div> | ||
<!--2photo--> | ||
<div class="photo_post" id="2"> |
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.
id="2"
не не не
это о другом не связываем прямвот так
Если прям гарантируем что на страничке пост всегда будет рисоваться только в одном месте то можно но с суфиксом: id="post-item-{id}"
А лучше помечать data аттрибутами
data-id="2"
UI/index.html
Outdated
<div class="image_name_date"><img class="post_image" src="images/103.png"/> | ||
<p class="name_date"><b>Murashko Yuliya</b><br>06.03.2018</p> | ||
</div> | ||
<div class="delete_redact"> |
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.
redact ... ??
edit :)
Но даже с edit, название класса не айс.
No description provided.