Comments (5)
존재하는 데이터의 구조만 바꿔달라는 요청인 것 같네요.
그런데 타입스크립트로 그냥 구현 하면 되는 거 아닌가요?
함수 하나만 만들면 될 것 같은데.
데이터를 저런 형식으로 반환하게끔 Django에 새로운 method를 만드는 것은 어려운 건 아닙니다만.
괜히 유지보수 하는 코드 늘어나는 것도 부담이고, 저 큰 데이터를 서버에서 한번 더 처리해야 하는 것도 부담이라서요.
from dgu2020_covid_front.
그리고 index
필드는 필요없습니다
for (const i in a_list) {}
이렇게 하면 저 i
에는 element가 아니라 index 번호가 할당됩니다.
const a_list = ["a", "b", "c"];
for ( const i in a_list ) {
console.log(i);
}
이 코드의 결과물은
a
b
c
가 아니라
0
1
2
가 됩니다.
from dgu2020_covid_front.
네 타입스크립트에서 구현하려는거예요! 함수를 짜고 있는데, 잘 나오지 않아서 issue에 올린 겁니다 ㅠㅠ index는 저도 굳이 넣어도 될 것 같진 않는데, 한 array에 같이 들어가는게 표를 짜기 더 좋아서 언급해두었습니다.
from dgu2020_covid_front.
function modify_data_struct(src: any) {
const result = [];
for (const acc_id in src) {
result.push({
acc_id: acc_id,
simil_identity: src["acc_id"]["simil_identity"],
simil_bit_score: src["acc_id"]["simil_bit_score"],
});
}
return result;
}
이런 식으로 하면 안 됩니까?
from dgu2020_covid_front.
헐 해결된것같습니다!
const lists = this.state.acc_id_list
const seq_list = [];
for (const acc_id in lists) {
seq_list.push({
acc_id: acc_id,
simil_identity: lists[acc_id][cst.KEY_SIMILARITY_IDENTITY],
simil_bit_score: lists[acc_id][cst.KEY_SIMILARITY_BIT_SCORE],
});
}
함수 말고, 말씀해주신 형식에서 아주 살짝 변형했습니다!
저번에 작성해주신 table for문이랑 비슷해서 저도 비슷하게 시도는 계속 해 봤던것 같은데...ㅎㅎ머쓱하네요
감사합니다. 덕분에 오늘 내로 완성할 수 있을 것 같습니다 :)
from dgu2020_covid_front.
Related Issues (9)
- Pages crash if db server is not online HOT 3
- Circle 크기 밸런스 조절 HOT 2
- 염기서열 클립보드로 복사 안 됨 HOT 1
- `유사 염기서열 조회` 페이지에서 how_many 인자를 250으로 고정하기 HOT 3
- InfoWindow에 어려움을 겪는 이유 HOT 1
- 지도 클래스 추상화 후 pr 올리겠습니다 HOT 5
- 레이아웃 도움이 필요합니다. HOT 2
- strain 침범 HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dgu2020_covid_front.