codestates / codestates/FilmStorage

[DevLog] 서외구 / 2022-04-08

Open
#280 0 comments 0 reactions 1 assignee Claimed by @sud665 View on GitHub
DevLog
Dominant language
JavaScript
Stars
5
Forks
5
PR merge metrics
No merged PRs in 30d

Description

### 오늘은 어떻게 프로젝트에 기여했나요?

- 필름취향 찾기 로직 재구성 후 기능 구현

### 오늘의 프로젝트에서 힘든 점은 무엇인가요?

- 취향찾기 로직 구성이 여러웠음
- 타입 -> 제조사 -> 감도 설정 순으로 하려 했으나, 단순한 테스트 형식이 되어 버려서 특색이 없어짐
- 여러 사진중에 랜덤하게 보여주고, 사진을 선택하여 해당 값을 useRef로 모아서 상태가 변하지 않게함
- 모은 선택된 값을 만들어 놓은 통계 알고리즘 함수에 넣어 나온 결과값을 토대로 필름을 랜더링 시켜줌

- 선택된 사진의 스타일을 변경하려고 했으나, 정확하게 이미지 변경이 안됨

```js
const testRef = useRef({});

testRef.current = { type: [], company: [], iso: [] };

// 사진 배열 바꾸기 슬라이스 함수
const handleNextPageTest = (e) => {
// 통계 데이터 수집
const { type, iso, company } = testRef.current;
const choiceValue = e.target.alt.split("&");

iso.push(choiceValue[0]);
type.push(choiceValue[1]);
company.push(choiceValue[2]);

if (type.length === 3) {
setFilmResult(filmResult.concat(testRef.current));
setFilmTypeList(filmTypeTest.splice(0, 9));
handleCounter();
}
};
const getCompanyResult = (result) => {
const companies = result[0].company.concat(
result[1].company,
result[2].company
);
const obj = {};
for (let i = 0; i < companies.length; i++) {
if (!obj[companies[i]]) {
obj[companies[i]] = 1;
} else {
obj[companies[i]]++;
}
}
const values = Object.values(obj);
const max = Math.max(...values);
for (let key in obj) {
let value = obj[key];
if (value === max) return key;
}
};

// 결과 로딩 함수
const handleFilmResult = () => {
console.log("나와라 뚝딱========>", filmResult);
// const typeResult = getTypeResult(filmResult);
const companyResult = getCompanyResult(filmResult);

setResultForRender(FilmDataResult[companyResult]);

console.log("결과 회사확인=========>", companyResult);

let secondTimer = setTimeout(() => setIsLoadResult(false), 2000);
return () => {
clearTimeout(secondTimer);
};
};
```

### 내일은 프로젝트에 기여하기 위해 무엇을 해야 하나요?

- [ ] 반응형 웹 기능 구현

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.