Skip to content

Commit 9d89e09

Browse files
authored
Merge pull request #42 from boostcampaitech3/sangryul
Sangryul
2 parents 6a0cfbb + eb25c2b commit 9d89e09

File tree

5 files changed

+73
-18
lines changed

5 files changed

+73
-18
lines changed

โ€Žfrontend/README.mdโ€Ž

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
# autograder
1+
# Gompada - Frontend
2+
3+
## Environment
4+
* node : v14.16.0 or above
25

36
## Project setup
47
```

โ€Žfrontend/src/components/main_input/AddProblem.vueโ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ export default {
223223
}
224224
h3{
225225
display:inline-block;
226+
margin-right : 5px;
226227
}
227228
code {
228229
padding: 0.25rem;

โ€Žfrontend/src/components/main_process/ShowResult.vueโ€Ž

Lines changed: 44 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,29 @@
11
<template>
22
<div v-show="loading">
33
<h2 class="result" ref="result">๊ฒฐ๊ณผ ํ™•์ธ</h2>
4-
<el-button size="small" class="result-button" type="primary" @click="tsvExport()">๊ฒฐ๊ณผ ์ถ”์ถœ (.TSV)</el-button>
5-
<table-view></table-view>
4+
<el-button class="result-button" type="primary" @click="tsvExport()">๊ฒฐ๊ณผ ์ถ”์ถœ (.TSV)</el-button>
5+
</br>
6+
<h3 class="alpha-header">Alpha ๊ฐ’ ์กฐ์ ˆ(%)</h3>
7+
<el-popover
8+
placement="top-start"
9+
title="์ตœ์ข…์ ์ˆ˜๋Š” ๋‹ค์Œ์˜ ๊ณต์‹์— ์˜ํ•˜์—ฌ ์ ์šฉ๋ฉ๋‹ˆ๋‹ค. alpha๊ฐ’์„ ์ ์šฉํ•˜์—ฌ weight๋ฅผ ๋‹ค๋ฅด๊ฒŒ ์ค„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค "
10+
width="250"
11+
trigger="hover">
12+
<template v-slot>
13+
<code>
14+
final_score = {keyword score * a + similarity score * (1-a)} * 100
15+
</code>
16+
</template>
17+
<i slot="reference" class="el-icon-info"></i>
18+
19+
</el-popover>
20+
<div class="block">
21+
<el-slider
22+
v-model="alpha"
23+
show-input>
24+
</el-slider>
25+
</div>
26+
<table-view :alpha=alpha></table-view>
627
<!-- <h2>๊ฒฐ๊ณผ ํ†ต๊ณ„</h2>
728
<graph-view></graph-view> -->
829
</div>
@@ -19,12 +40,16 @@ export default {
1940
2041
},
2142
watch : {
43+
alpha(val, old){
44+
//this.preprocessExport(val)
45+
},
2246
loading(val, old){
2347
// console.log(val, old)
2448
//this.$refs.result.$el.scrollIntoView({ behavior: 'smooth' });
2549
}
2650
},
2751
computed : {
52+
2853
loading(){
2954
return !this.$store.getters.getLoadingStatus
3055
},
@@ -35,6 +60,7 @@ export default {
3560
data(){
3661
return{
3762
studentResult : [],
63+
alpha: 50,
3864
}
3965
},
4066
methods : {
@@ -49,6 +75,13 @@ export default {
4975
}
5076
return message
5177
},
78+
calTotalScore(key_score, sim_score, alpha){
79+
80+
let a = alpha / 100
81+
let final_score = ((key_score * a + sim_score * (1 - a)) * 100).toFixed(2)
82+
return final_score
83+
84+
},
5285
preprocessExport(){
5386
let data = this.$store.getters.getResult
5487
data = data.problem
@@ -70,12 +103,11 @@ export default {
70103
sim_score : value.sim_score,
71104
sim_message : this.checkSimText(value.sim_score),
72105
keyword_score : value.keyword_score,
73-
final_score : Math.round(
74-
(value.keyword_score * 0.5 + value.sim_score * 0.5) * 100
75-
)
106+
final_score : this.calTotalScore(value.keyword_score, value.sim_score, this.alpha)
107+
76108
77109
}
78-
console.log(property)
110+
79111
this.studentResult.push(property)
80112
81113
})
@@ -85,7 +117,7 @@ export default {
85117
},
86118
tsvExport() {
87119
88-
let name = this.testName ? `${this.textName}.tsv`: "export.tsv"
120+
let name = this.testName ? `${this.testName}.tsv`: "export.tsv"
89121
this.preprocessExport()
90122
let arrData = this.studentResult
91123
let csvContent = "data:text/tsv;charset=utf-8,";
@@ -114,4 +146,9 @@ export default {
114146
.result-button{
115147
margin : 0 0 0 10px;
116148
}
149+
h3{
150+
display:inline-block;
151+
margin : 0 5px 0 0;
152+
}
153+
117154
</style>

โ€Žfrontend/src/components/main_process/TableView.vueโ€Ž

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ export default {
8787
components: {
8888
WordHighlighter,
8989
},
90+
props : [
91+
'alpha'
92+
],
9093
data() {
9194
return {
9295
True : true,
@@ -144,6 +147,7 @@ export default {
144147
// }]
145148
},
146149
dialogTableVisible: false,
150+
rawData : null,
147151
}
148152
},
149153
computed : {
@@ -153,10 +157,14 @@ export default {
153157
154158
},
155159
watch : {
160+
alpha(val, old){
161+
this.preprocess_modal(this.rawData.problem, val)
162+
this.preprocess_table(this.gridData)
163+
},
156164
loading(val, old){
157-
let data = this.$store.getters.getResult
165+
this.rawData = this.$store.getters.getResult
158166
//console.log(data)
159-
this.preprocess_modal(data.problem)
167+
this.preprocess_modal(this.rawData.problem)
160168
this.preprocess_table(this.gridData)
161169
}
162170
},
@@ -201,8 +209,15 @@ export default {
201209
this.current_id = row.student_id
202210
//console.log(this.current_id)
203211
},
212+
calTotalScore(key_score, sim_score, alpha){
213+
214+
let a = alpha / 100
215+
let final_score = ((key_score * a + sim_score * (1 - a)) * 100).toFixed(2)
216+
217+
return final_score
204218
205-
preprocess_modal(data){
219+
},
220+
preprocess_modal(data, alpha=50){
206221
this.studentResult = {}
207222
208223
data.forEach((v, i) => {
@@ -221,12 +236,10 @@ export default {
221236
sim_score : value.sim_score,
222237
sim_message : this.checkSimText(value.sim_score),
223238
keyword_score : value.keyword_score,
224-
final_score : Math.round(
225-
(value.keyword_score * 0.5 + value.sim_score * 0.5) * 100
226-
)
239+
final_score : this.calTotalScore(value.keyword_score, value.sim_score, alpha)
227240
228241
}
229-
console.log(property)
242+
// console.log(property)
230243
if(this.studentResult.hasOwnProperty(student_id)){
231244
this.studentResult[student_id].push(property)
232245
}else{
@@ -237,7 +250,7 @@ export default {
237250
})
238251
239252
this.gridData = this.studentResult
240-
console.log(this.gridData)
253+
241254
},
242255
243256
preprocess_table(data){
@@ -249,9 +262,10 @@ export default {
249262
data[student_id].forEach((v, i) => {
250263
score += v.final_score
251264
})
265+
//console.log(score)
252266
this.tableData.push({
253267
student_id : student_id,
254-
score : `${score} / ${data[student_id].length * 100}`
268+
score : `${Number(score)} / ${data[student_id].length * 100}`
255269
256270
})
257271
}

โ€Žfrontend/vue.config.jsโ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ module.exports = defineConfig({
2222
devServer : {
2323
proxy : {
2424
'/api' : {
25-
target : "http://27.96.130.147:30003",
25+
target : "http://27.96.130.147:30001",
2626
changeOrigin : true
2727
}
2828
}

0 commit comments

Comments
ย (0)