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

task4 #6

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

task4 #6

wants to merge 11 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Mar 6, 2018

No description provided.

UI/script.js Outdated
return result;
}

function filterHashtag(photoPosts, hashtag) {
Copy link

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) {
Copy link

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) {
Copy link

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);
Copy link

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) {
Copy link

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)) {
Copy link

Choose a reason for hiding this comment

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

я могу ошибаться, но что-то мне подсказывает что это плохая идея т.к не все поля обязательны

Copy link

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) {
Copy link

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');
}
Copy link

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));
Copy link

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') {
Copy link

Choose a reason for hiding this comment

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

typeof id !== 'string' этого будет достаточно

Copy link

@ala-n ala-n left a 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>
Copy link

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);
Copy link

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) {
Copy link

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 = [];
Copy link

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) {
Copy link

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) {
Copy link

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) {
Copy link

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']});
Copy link

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">
Copy link

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">
Copy link

Choose a reason for hiding this comment

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

redact ... ??
edit :)
Но даже с edit, название класса не айс.

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.

3 participants