Skip to content

lec3 - Step2.다양한 출력 지원#48

Merged
crongro merged 27 commits intocode-squad:masterfrom
HTMLhead:step2
Oct 10, 2018
Merged

lec3 - Step2.다양한 출력 지원#48
crongro merged 27 commits intocode-squad:masterfrom
HTMLhead:step2

Conversation

@HTMLhead
Copy link
Copy Markdown

@HTMLhead HTMLhead commented Oct 9, 2018

  • 피드백에 의한 수정

    1. 중복되는 숫자를 todo.task로부터 찾아와 sync가 완벽하게 맞도록 수정함과 동시에 쓸모없는 배열을 제거했습니다.
    2. console.log를 print함수 쪽으로 모두 모았습니다. 인자로 받은 값에 따라 출력하는 방식이 달라지는 printChangeThing함수를 만들었습니다.
  • step2 구현맥락

    1. todo.task배열 내의 객체를 만들때 처음부터 timeData 라는 항목을 만들었습니다, timeData에 status가 doing으로 변할 때의 시간을 저장했고, 그 시간을 이용해서 done으로 변할 때까지 걸린 시간 정보를 timeData가 가질 수 있도록 구현했습니다.
    2. todo.showTag메서드를 위해 printByTag메서드와 getSameTagAndStatusNum메서드를 만들었습니다.
    3. showTags메서드를 위해 getTagArrays메서드와 printSameTag, getSameTagNum메서드를 만들었습니다.
  • 노력한점

    1. 함수가 한 가지 일만 할 수 있도록 잘 나누어보려고 했습니다.
    2. 시간정보를 어디에 저장해야할지 많이 고민했습니다.

많은 피드백은 항상 감사드립니다!!

HTMLhead and others added 27 commits October 3, 2018 21:28
* 스켈레톤 코드 작성

* 수많은 에러가 담긴 todo객체의 add함수 추가(id의 값을 제대로 가지지 못함, todo객체의 getStatusNum수정 필요

* 랜덤한 id값을 못가져오는 것을 수정. checkOverlap함수를 통해서 id의 값이 같지않도록 구현

* todo.add함수기능 완벽하게 구현

* todo.update함수 완성

* id를 입력받아 할일을 제거해주는 todo.remove함수 완성, 오류가많은 todo.printTask함수 완성

* todo.printTask함수 완성, tag를 확인하는 함수 제거(printTask를 통해 각 할일들의 태그가 무엇인지 확인이 가능하므로)

* todo.printTagRelate 함수 완성, todo.add함수에서 버그를 발견함

* 새로운 객체 안 배열에 저장하도록 만들어 문제 해결

* remove함수를 호출했을때, saveData.task배열에서 지워지는것 뿐 아니라 saveData.idArrays배열에서도 id를 지워지게 수정

* 테스트코드를 주석처리함 들여쓰기를 다시 맞춤

* saveData객체를 없애고 그 내용을 todo객체 안으로 집어 넣음, todo.idArrays의 값은 todo.add를 호출할때마다 추가되도록 수정.

* if(saveData.idArrays.indexOf(ranNum) !== -1)-> if(this.idArrays.includes(ranNum))으로 변경

* 기나긴 삼항연산자 statusNum[obj.status]++로 해결

* todo.update함수에서 바뀐 상태의 상태를 반영하지 않는 버그를 찾아내서 수정

* 함수마다 간단한 주석을 달아줌
… 인자로 입력받아 경과된 시간을 반환해주는 getTakeTime 함수 구현
…받아 같은인자와 tag를 출력, showTag메서드는 그 값을 세번 불러서 서로다른 3가지의 status값을 모두 출력.
…정(상태가done이면 doing항목을 출력하라고 입력했을때 done항목도 같이 출력되었었음)
Copy link
Copy Markdown
Contributor

@crongro crongro left a comment

Choose a reason for hiding this comment

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

잘 구현하셨네요.
리뷰 참고해서 다음단계 개발 진행해보세요.

다음단계에서는 객체를 추가로 구현하셔야 합니다.
또는 현재까지의 코드를, 객체단위로 별도로 분리하고 싶다면, 분리하고 다음단계 가도 좋고요.

기능완성도를 확인하기 위해서 동료에게 테스트를 부탁해보시고요.

const todo = {
task: [],

add: function (objToAdd) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

add(objTodAdd) { ..}
이렇게 간단하게 표현가능합니다.

},//중복되지 않는 랜덤한 숫자를뽑아내는 함수

getStatusNum: function (accumulatedTask) {
const statusNum = {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

여러메서드에서 사용하는 것이면 this.statusNum = {}
해도 될 거 같아요.

updateTakeTime: function (objToUpdate) {
this.task.forEach(taskObj => {
if (taskObj.id === objToUpdate.id) {
taskObj.timeData = this.getTakeTime(taskObj.timeData, Date.now())
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

네 시간값은 각 task 객체 표현하는 게 좋은거 같네요.

return sameTagNum
},//같은 태그의 개수를 세어주는 함수

showAll: function () {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

잘 했습니다.
이렇게 구현하는 게 맞고요.
일정하지는 않지만 중복호출이니, 아래 부분을 재귀적으로 한번 바꿔보세요

@crongro crongro merged commit b745355 into code-squad:master Oct 10, 2018
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