Skip to content

Commit 716155b

Browse files
committed
chore: run lint
1 parent cc43a66 commit 716155b

29 files changed

+1338
-1160
lines changed

biome.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"formatter": {
2323
"jsxQuoteStyle": "double",
2424
"quoteProperties": "asNeeded",
25-
"trailingComma": "all",
25+
"trailingCommas": "all",
2626
"semicolons": "always",
2727
"arrowParentheses": "always",
2828
"bracketSpacing": true,

src/components/Modal.vue

Lines changed: 139 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -115,169 +115,180 @@
115115
</el-dialog>
116116
</template>
117117
<script>
118-
import _ from 'lodash'
119-
import draggable from 'vuedraggable'
120-
import { NextAPI } from '../services/NextAPI'
121-
import matriculaUtils from '../utils/Matricula'
122-
import { convertDisciplina } from '../utils/convertUfabcDisciplina'
123-
import { findSeasonKey, findIdeais } from '../utils/season'
118+
import _ from 'lodash';
119+
import draggable from 'vuedraggable';
120+
import { NextAPI } from '../services/NextAPI';
121+
import matriculaUtils from '../utils/Matricula';
122+
import { convertDisciplina } from '../utils/convertUfabcDisciplina';
123+
import { findSeasonKey, findIdeais } from '../utils/season';
124124
125-
const nextApi = NextAPI();
125+
const nextApi = NextAPI();
126126
127-
export default {
128-
name: 'Modal',
129-
props: ['value'],
130-
components: {
131-
draggable,
132-
},
133-
data() {
134-
return {
135-
loading: false,
136-
disciplina: {},
137-
138-
headers: [],
127+
export default {
128+
name: 'Modal',
129+
props: ['value'],
130+
components: {
131+
draggable,
132+
},
133+
data() {
134+
return {
135+
loading: false,
136+
disciplina: {},
139137
140-
kicksData: [],
141-
}
142-
},
138+
headers: [],
143139
144-
created() {
145-
this.fetch()
146-
},
140+
kicksData: [],
141+
};
142+
},
147143
148-
watch: {
149-
'value.dialog'(v) {
150-
this.restore()
151-
},
144+
created() {
145+
this.fetch();
146+
},
152147
153-
'value.corte_id'(val){
154-
this.disciplina = _.find(todasDisciplinas, { id: parseInt(val) })
155-
this.headers = this.defaultHeaders
156-
this.fetch()
157-
},
148+
watch: {
149+
'value.dialog'(v) {
150+
this.restore();
158151
},
159152
160-
computed: {
161-
transformed() {
162-
return this.kicksData.map(d => {
163-
return _.assign(_.clone(d), {
164-
reserva: d.reserva ? 'Sim' : 'Não',
165-
ik: d.ik.toFixed(3)
166-
})
167-
})
168-
},
153+
'value.corte_id'(val) {
154+
this.disciplina = _.find(todasDisciplinas, { id: parseInt(val) });
155+
this.headers = this.defaultHeaders;
156+
this.fetch();
157+
},
158+
},
169159
170-
defaultHeaders() {
171-
let isIdeal = findIdeais().includes(this.disciplina.codigo)
160+
computed: {
161+
transformed() {
162+
return this.kicksData.map((d) => {
163+
return _.assign(_.clone(d), {
164+
reserva: d.reserva ? 'Sim' : 'Não',
165+
ik: d.ik.toFixed(3),
166+
});
167+
});
168+
},
172169
173-
const base = [
174-
{ text: 'Reserva', sortable: false, value: 'reserva' },
175-
{ text: 'Turno', value: 'turno', sortable: false },
176-
{ text: 'Ik', value: 'ik', sortable: false },
177-
]
170+
defaultHeaders() {
171+
let isIdeal = findIdeais().includes(this.disciplina.codigo);
178172
179-
const season = findSeasonKey()
173+
const base = [
174+
{ text: 'Reserva', sortable: false, value: 'reserva' },
175+
{ text: 'Turno', value: 'turno', sortable: false },
176+
{ text: 'Ik', value: 'ik', sortable: false },
177+
];
180178
181-
if(isIdeal && (season != '2020:3' || season != '2021:1' || season != '2021:2')) {
182-
base.push({ text: 'CR', value: 'cr', sortable: false })
183-
base.push({ text: 'CP', value: 'cp', sortable: false })
184-
} else {
185-
base.push({ text: 'CP', value: 'cp', sortable: false })
186-
base.push({ text: 'CR', value: 'cr', sortable: false })
187-
}
179+
const season = findSeasonKey();
188180
189-
return base
190-
},
181+
if (
182+
isIdeal &&
183+
(season != '2020:3' || season != '2021:1' || season != '2021:2')
184+
) {
185+
base.push({ text: 'CR', value: 'cr', sortable: false });
186+
base.push({ text: 'CP', value: 'cp', sortable: false });
187+
} else {
188+
base.push({ text: 'CP', value: 'cp', sortable: false });
189+
base.push({ text: 'CR', value: 'cr', sortable: false });
190+
}
191191
192-
getRequests() {
193-
return _.reduce(matriculas, (a, c) => c.includes(this.disciplina.id.toString()) ? a + 1 : a, 0)
194-
},
192+
return base;
193+
},
195194
196-
computeKicksForecast() {
197-
return (this.kicksData.length * this.disciplina.vagas) / this.getRequests
198-
},
195+
getRequests() {
196+
return _.reduce(
197+
matriculas,
198+
(a, c) => (c.includes(this.disciplina.id.toString()) ? a + 1 : a),
199+
0,
200+
);
201+
},
199202
200-
parsedDisciplina() {
201-
return convertDisciplina(this.disciplina)
202-
}
203+
computeKicksForecast() {
204+
return (this.kicksData.length * this.disciplina.vagas) / this.getRequests;
205+
},
203206
207+
parsedDisciplina() {
208+
return convertDisciplina(this.disciplina);
204209
},
210+
},
205211
206-
methods: {
207-
fetch() {
208-
let corteId = _.get(this.value, 'corte_id', '')
209-
if(!corteId) return
210-
const aluno_id = matriculaUtils.getAlunoId()
212+
methods: {
213+
fetch() {
214+
let corteId = _.get(this.value, 'corte_id', '');
215+
if (!corteId) return;
216+
const aluno_id = matriculaUtils.getAlunoId();
211217
212-
this.loading = true
218+
this.loading = true;
213219
214-
nextApi.get(`/disciplinas/${corteId}/kicks?aluno_id=${aluno_id}`).then((res) => {
215-
this.kicksData = res
216-
this.resort()
217-
this.loading = false
218-
}).catch((e) => {
219-
this.loading = false
220+
nextApi
221+
.get(`/disciplinas/${corteId}/kicks?aluno_id=${aluno_id}`)
222+
.then((res) => {
223+
this.kicksData = res;
224+
this.resort();
225+
this.loading = false;
226+
})
227+
.catch((e) => {
228+
this.loading = false;
220229
221-
if(e && e.name == 'Forbidden') {
230+
if (e && e.name == 'Forbidden') {
222231
// Show dialog with error
223232
this.$notify({
224-
message: 'Não temos as diciplinas que você cursou, acesse o Portal do Aluno'
225-
})
233+
message:
234+
'Não temos as diciplinas que você cursou, acesse o Portal do Aluno',
235+
});
226236
}
227-
})
228-
},
237+
});
238+
},
229239
230-
resort(e) {
231-
const sortOrder = _.map(this.headers, 'value')
232-
const sortRef = Array(sortOrder.length || 0).fill('desc')
240+
resort(e) {
241+
const sortOrder = _.map(this.headers, 'value');
242+
const sortRef = Array(sortOrder.length || 0).fill('desc');
233243
234-
const turnoIndex = sortOrder.indexOf('turno')
235-
if(turnoIndex != -1) {
236-
sortRef[turnoIndex] = (this.parsedDisciplina.turno == 'diurno') ? 'asc' : 'desc'
237-
}
244+
const turnoIndex = sortOrder.indexOf('turno');
245+
if (turnoIndex != -1) {
246+
sortRef[turnoIndex] =
247+
this.parsedDisciplina.turno == 'diurno' ? 'asc' : 'desc';
248+
}
238249
239-
this.kicksData = _.orderBy(this.kicksData, sortOrder, sortRef)
240-
},
250+
this.kicksData = _.orderBy(this.kicksData, sortOrder, sortRef);
251+
},
241252
242-
removedFilter(value) {
243-
this.headers = _.filter(this.headers, o => o.value != value)
244-
this.resort()
245-
},
253+
removedFilter(value) {
254+
this.headers = _.filter(this.headers, (o) => o.value != value);
255+
this.resort();
256+
},
246257
247-
restore() {
248-
this.headers = this.defaultHeaders
249-
this.resort()
250-
},
258+
restore() {
259+
this.headers = this.defaultHeaders;
260+
this.resort();
261+
},
251262
252-
closeDialog(){
253-
this.value.dialog = false
254-
},
263+
closeDialog() {
264+
this.value.dialog = false;
265+
},
255266
256-
// kickStatus(rowIndex) {
257-
// console.log("rowIndex", rowIndex)
258-
// console.log("this.computeKicksForecast", this.computeKicksForecast)
259-
// if(rowIndex <= this.computeKicksForecast) {
260-
// return 'not-kicked'
261-
// }else if(rowIndex >= this.disciplina.vagas){
262-
// return 'kicked'
263-
// }else {
264-
// return 'probably-kicked'
265-
// }
266-
// },
267+
// kickStatus(rowIndex) {
268+
// console.log("rowIndex", rowIndex)
269+
// console.log("this.computeKicksForecast", this.computeKicksForecast)
270+
// if(rowIndex <= this.computeKicksForecast) {
271+
// return 'not-kicked'
272+
// }else if(rowIndex >= this.disciplina.vagas){
273+
// return 'kicked'
274+
// }else {
275+
// return 'probably-kicked'
276+
// }
277+
// },
267278
268-
tableRowClassName({row, rowIndex}) {
269-
if (row.aluno_id == matriculaUtils.getAlunoId()) {
270-
return 'aluno-row'
271-
} else if(rowIndex <= this.computeKicksForecast) {
272-
return 'not-kicked-row'
273-
}else if(rowIndex >= this.disciplina.vagas){
274-
return 'kicked-row'
275-
}else {
276-
return 'probably-kicked-row'
277-
}
279+
tableRowClassName({ row, rowIndex }) {
280+
if (row.aluno_id == matriculaUtils.getAlunoId()) {
281+
return 'aluno-row';
282+
} else if (rowIndex <= this.computeKicksForecast) {
283+
return 'not-kicked-row';
284+
} else if (rowIndex >= this.disciplina.vagas) {
285+
return 'kicked-row';
286+
} else {
287+
return 'probably-kicked-row';
278288
}
279289
},
280-
}
290+
},
291+
};
281292
</script>
282293
<style scoped>
283294
.information {

0 commit comments

Comments
 (0)