mirror of
https://github.com/UniversityOfHelsinkiCS/ohtuilmo.git
synced 2026-10-12 19:03:41 +03:00
chore: update oxlint config and fix lint errors
This commit is contained in:
@@ -220,9 +220,11 @@ configurationsRouter.delete(
|
|||||||
const success = await db.Configuration.destroy({
|
const success = await db.Configuration.destroy({
|
||||||
where: { id: req.params.configurationId },
|
where: { id: req.params.configurationId },
|
||||||
})
|
})
|
||||||
success
|
if (success) {
|
||||||
? console.log(`Configuration ${req.params.configurationId} destroyed.`)
|
console.log(`Configuration ${req.params.configurationId} destroyed.`)
|
||||||
: console.log('Nothing to delete.')
|
} else {
|
||||||
|
console.log('Nothing to delete.')
|
||||||
|
}
|
||||||
return res.status(204).end()
|
return res.status(204).end()
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -242,7 +242,7 @@ emailRouter.get('/templates', checkAdmin, async (req, res) => {
|
|||||||
|
|
||||||
const payload = templates.length > 0 ? templates[0] : defaultEmailTemplates
|
const payload = templates.length > 0 ? templates[0] : defaultEmailTemplates
|
||||||
return res.json(serializeTemplatesByLanguage(payload))
|
return res.json(serializeTemplatesByLanguage(payload))
|
||||||
} catch (err) {
|
} catch {
|
||||||
res.status(500).json({ error: 'Something is wrong... try reloading the page' })
|
res.status(500).json({ error: 'Something is wrong... try reloading the page' })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -281,7 +281,7 @@ const parseTemplates = (req, res, next) => {
|
|||||||
templates: deserialized
|
templates: deserialized
|
||||||
}
|
}
|
||||||
next()
|
next()
|
||||||
} catch (e) {
|
} catch {
|
||||||
res.status(500).json({ error: 'internal server error' })
|
res.status(500).json({ error: 'internal server error' })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -311,7 +311,7 @@ emailRouter.post(
|
|||||||
customer_review_link_eng
|
customer_review_link_eng
|
||||||
})
|
})
|
||||||
res.status(200).json(serializeTemplatesByLanguage(createdTemplates))
|
res.status(200).json(serializeTemplatesByLanguage(createdTemplates))
|
||||||
} catch (e) {
|
} catch {
|
||||||
res.status(500).json({ error: 'Something is wrong... try reloading the page' })
|
res.status(500).json({ error: 'Something is wrong... try reloading the page' })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -283,9 +283,11 @@ router.put('/:groupId', checkAdmin, async (req, res) => {
|
|||||||
|
|
||||||
router.delete('/:groupId', checkAdmin, async (req, res) => {
|
router.delete('/:groupId', checkAdmin, async (req, res) => {
|
||||||
const success = await db.Group.destroy({ where: { id: req.params.groupId } })
|
const success = await db.Group.destroy({ where: { id: req.params.groupId } })
|
||||||
success
|
if (success) {
|
||||||
? console.log(`Group ${req.params.groupId} destroyed.`)
|
console.log(`Group ${req.params.groupId} destroyed.`)
|
||||||
: console.log('Nothing to delete.')
|
} else {
|
||||||
|
console.log('Nothing to delete.')
|
||||||
|
}
|
||||||
return res.status(204).end()
|
return res.status(204).end()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ instructorTimeLogsRouter.get('/', checkInstructor, async (req, res) => {
|
|||||||
try {
|
try {
|
||||||
const timeLogs = await fetchAllFromDb()
|
const timeLogs = await fetchAllFromDb()
|
||||||
return res.status(200).json(timeLogs)
|
return res.status(200).json(timeLogs)
|
||||||
} catch (error) {
|
} catch {
|
||||||
return res.status(500).json({ error: 'Error fetching time logs.' })
|
return res.status(500).json({ error: 'Error fetching time logs.' })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ timeLogsRouter.get('/', checkLogin, async (req, res) => {
|
|||||||
const user_id = req.user.id
|
const user_id = req.user.id
|
||||||
const timeLogs = user_id ? await fetchFromDb(user_id) : []
|
const timeLogs = user_id ? await fetchFromDb(user_id) : []
|
||||||
return res.status(200).json(timeLogs)
|
return res.status(200).json(timeLogs)
|
||||||
} catch (error) {
|
} catch {
|
||||||
return res.status(500).json({ error: 'Error fetching time logs.' })
|
return res.status(500).json({ error: 'Error fetching time logs.' })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
+1
-1
@@ -33,7 +33,7 @@ const shibbolethHeaders = [
|
|||||||
app.use(cors())
|
app.use(cors())
|
||||||
app.use(bodyParser.json({ limit: '100mb' }))
|
app.use(bodyParser.json({ limit: '100mb' }))
|
||||||
app.use(headersMiddleware(shibbolethHeaders))
|
app.use(headersMiddleware(shibbolethHeaders))
|
||||||
isDevelopmentEnvironment() && app.use(fakeshibbo)
|
if (isDevelopmentEnvironment()) app.use(fakeshibbo)
|
||||||
app.use(unless('/api/login', logger))
|
app.use(unless('/api/login', logger))
|
||||||
|
|
||||||
// Routers
|
// Routers
|
||||||
|
|||||||
@@ -16,5 +16,13 @@
|
|||||||
"rules": {
|
"rules": {
|
||||||
"eqeqeq": "error",
|
"eqeqeq": "error",
|
||||||
"react-hooks/exhaustive-deps": "warn"
|
"react-hooks/exhaustive-deps": "warn"
|
||||||
}
|
},
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"files": ["src/components/RegistrationDetailsPage.jsx"],
|
||||||
|
"rules": {
|
||||||
|
"react/no-did-mount-set-state": "warn"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
@@ -116,8 +116,8 @@ const App = (props) => {
|
|||||||
|
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
updateIsLoading(true)
|
updateIsLoading(true)
|
||||||
!isCustomerReviewPage && (await handleLogin())
|
if (!isCustomerReviewPage) await handleLogin()
|
||||||
user && (await handleGroupInit())
|
if (user) await handleGroupInit()
|
||||||
await fetchRegistrationManagementData()
|
await fetchRegistrationManagementData()
|
||||||
updateIsLoading(false)
|
updateIsLoading(false)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ const AdminSprintsPage = (props) => {
|
|||||||
await fetchSprints(selectedGroupId)
|
await fetchSprints(selectedGroupId)
|
||||||
setIsLoading(false)
|
setIsLoading(false)
|
||||||
}
|
}
|
||||||
selectedGroup?.id && fetchData(selectedGroup.id)
|
if (selectedGroup?.id) fetchData(selectedGroup.id)
|
||||||
}, [selectedGroup, selectedConfiguration])
|
}, [selectedGroup, selectedConfiguration])
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class EmailTemplatesPage extends React.Component {
|
|||||||
try {
|
try {
|
||||||
await this.props.updateEmailTemplates(newTemplates)
|
await this.props.updateEmailTemplates(newTemplates)
|
||||||
this.props.setSuccess('Email templates saved!')
|
this.props.setSuccess('Email templates saved!')
|
||||||
} catch (e) {
|
} catch {
|
||||||
this.props.setError('Failed to update email templates')
|
this.props.setError('Failed to update email templates')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ const GroupManagementPage = (props) => {
|
|||||||
setUsers(fetchedUsers)
|
setUsers(fetchedUsers)
|
||||||
setGroups(fetchedGroups)
|
setGroups(fetchedGroups)
|
||||||
await fetchTopics()
|
await fetchTopics()
|
||||||
} catch (err) {
|
} catch {
|
||||||
setError('Some error happened')
|
setError('Some error happened')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -311,7 +311,7 @@ const Review = ({ student, updateAnswer, index }) => {
|
|||||||
const Reviews = ({ answerSheet, updateAnswer }) => {
|
const Reviews = ({ answerSheet, updateAnswer }) => {
|
||||||
return answerSheet.map((student, index) => {
|
return answerSheet.map((student, index) => {
|
||||||
return (
|
return (
|
||||||
<Review student={student} updateAnswer={updateAnswer} index={index} />
|
<Review key={index} student={student} updateAnswer={updateAnswer} index={index} />
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,13 @@ import timeLogService from '../services/timeLogs'
|
|||||||
|
|
||||||
import TextField from '@material-ui/core/TextField'
|
import TextField from '@material-ui/core/TextField'
|
||||||
import Button from '@material-ui/core/Button'
|
import Button from '@material-ui/core/Button'
|
||||||
import { Table, TableHead, TableRow, TableBody, TableCell } from '@material-ui/core'
|
import {
|
||||||
|
Table,
|
||||||
|
TableHead,
|
||||||
|
TableRow,
|
||||||
|
TableBody,
|
||||||
|
TableCell,
|
||||||
|
} from '@material-ui/core'
|
||||||
|
|
||||||
class PeerReview extends React.Component {
|
class PeerReview extends React.Component {
|
||||||
async componentDidMount() {
|
async componentDidMount() {
|
||||||
@@ -264,7 +270,7 @@ const Question = ({
|
|||||||
updateAnswer,
|
updateAnswer,
|
||||||
updatePeerReview,
|
updatePeerReview,
|
||||||
}) => {
|
}) => {
|
||||||
if (!questionId === undefined) {
|
if (!questionId) {
|
||||||
console.error('No questionId given')
|
console.error('No questionId given')
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
@@ -281,10 +287,7 @@ const Question = ({
|
|||||||
return (
|
return (
|
||||||
<div className="peer-review-box">
|
<div className="peer-review-box">
|
||||||
<h3 className="peer-review-box__h3">{question.header}</h3>
|
<h3 className="peer-review-box__h3">{question.header}</h3>
|
||||||
<Table
|
<Table size="small" className="peer-review-box__radio-button-table">
|
||||||
size="small"
|
|
||||||
className="peer-review-box__radio-button-table"
|
|
||||||
>
|
|
||||||
<TableHead>
|
<TableHead>
|
||||||
<TableRow hover>
|
<TableRow hover>
|
||||||
<TableCell className="peer-review-box__radio-header" />
|
<TableCell className="peer-review-box__radio-header" />
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ const validateQuestionsJson = (str) => {
|
|||||||
return { ok: false, error: 'Questions should be an array' }
|
return { ok: false, error: 'Questions should be an array' }
|
||||||
}
|
}
|
||||||
return { ok: true }
|
return { ok: true }
|
||||||
} catch (err) {
|
} catch {
|
||||||
return { ok: false, error: 'Field contains invalid JSON' }
|
return { ok: false, error: 'Field contains invalid JSON' }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ const StudentTagPage = (props) => {
|
|||||||
|
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
setIsLoading(true)
|
setIsLoading(true)
|
||||||
group?.id && (await fetchSprints())
|
if (group?.id) await fetchSprints()
|
||||||
await tagService.getTagsByStudent(user.studentNumber).then((data) => {
|
await tagService.getTagsByStudent(user.studentNumber).then((data) => {
|
||||||
setStudentTags(data)
|
setStudentTags(data)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ const InstructorTimeLogsPage = (props) => {
|
|||||||
await fetchSprintData(selectedGroupId)
|
await fetchSprintData(selectedGroupId)
|
||||||
setIsLoading(false)
|
setIsLoading(false)
|
||||||
}
|
}
|
||||||
selectedGroupId && fetchChartData(selectedGroupId)
|
if (selectedGroupId) fetchChartData(selectedGroupId)
|
||||||
}, [selectedGroupId])
|
}, [selectedGroupId])
|
||||||
|
|
||||||
const handleTimeLogCheck = (logId) => {
|
const handleTimeLogCheck = (logId) => {
|
||||||
@@ -233,7 +233,7 @@ const InstructorTimeLogsPage = (props) => {
|
|||||||
const updatedLogs = await instructorTimeLogsService.deleteTimeLog(logId)
|
const updatedLogs = await instructorTimeLogsService.deleteTimeLog(logId)
|
||||||
setAllLogs(updatedLogs)
|
setAllLogs(updatedLogs)
|
||||||
setSuccess('Time log deleted successfully')
|
setSuccess('Time log deleted successfully')
|
||||||
} catch (error) {
|
} catch {
|
||||||
setError('Error deleting time log')
|
setError('Error deleting time log')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React, { useState, useEffect } from 'react'
|
import React, { useState, useEffect } from 'react'
|
||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import { ResponsiveContainer, BarChart, XAxis, YAxis, Tooltip, ReferenceLine, Label, LabelList, Bar, Cell } from 'recharts'
|
import { ResponsiveContainer, BarChart, XAxis, YAxis, Tooltip, ReferenceLine, LabelList, Bar, Cell } from 'recharts'
|
||||||
import { NoTimeLogsPlaceholderSprint, NoTimeLogsPlaceholderProject } from '../common/Placeholders'
|
import { NoTimeLogsPlaceholderSprint, NoTimeLogsPlaceholderProject } from '../common/Placeholders'
|
||||||
import Error from '@material-ui/icons/Error'
|
import Error from '@material-ui/icons/Error'
|
||||||
import { useTheme } from '@material-ui/core/styles';
|
import { useTheme } from '@material-ui/core/styles';
|
||||||
@@ -130,7 +130,7 @@ const checkStudentProgressPaceTotal = (studentName, allStudentHours, totalDurati
|
|||||||
const checkStudentProgressPacePerSprint = (targetStudent, allStudentHours, allSprintDates, isShortProject) => {
|
const checkStudentProgressPacePerSprint = (targetStudent, allStudentHours, allSprintDates, isShortProject) => {
|
||||||
const { idealHoursPerDay, okHoursPerDay, dangerousHoursPerDay } = getProjectHours(isShortProject)
|
const { idealHoursPerDay, okHoursPerDay, dangerousHoursPerDay } = getProjectHours(isShortProject)
|
||||||
const sprintPaces = {}
|
const sprintPaces = {}
|
||||||
allStudentHours.forEach((student, index) => {
|
allStudentHours.forEach((student, _index) => {
|
||||||
if (student.sprint === -1)
|
if (student.sprint === -1)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { useEffect, useState, useCallback } from 'react'
|
import React, { useEffect, useState } from 'react'
|
||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import { withRouter } from 'react-router-dom'
|
import { withRouter } from 'react-router-dom'
|
||||||
import { TimeLogForm } from './TimeLogForm'
|
import { TimeLogForm } from './TimeLogForm'
|
||||||
@@ -107,9 +107,9 @@ const TimeLogsPage = (props) => {
|
|||||||
}
|
}
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
setIsLoading(true)
|
setIsLoading(true)
|
||||||
group?.id && await fetchSprints()
|
if (group?.id) await fetchSprints()
|
||||||
await fetchTimeLogs()
|
await fetchTimeLogs()
|
||||||
group?.id && await fetchGroupSprintSummary(group.id)
|
if (group?.id) await fetchGroupSprintSummary(group.id)
|
||||||
await fetchTags()
|
await fetchTags()
|
||||||
setIsLoading(false)
|
setIsLoading(false)
|
||||||
}
|
}
|
||||||
@@ -131,12 +131,14 @@ const TimeLogsPage = (props) => {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
currentSprintObject && setCurrentSprintNumber(currentSprintObject.sprint)
|
if (currentSprintObject) {
|
||||||
currentSprintObject && setSelectedSprintNumber(currentSprintObject.sprint)
|
setCurrentSprintNumber(currentSprintObject.sprint)
|
||||||
!currentSprintObject &&
|
setSelectedSprintNumber(currentSprintObject.sprint)
|
||||||
|
} else {
|
||||||
setSelectedSprintNumber(
|
setSelectedSprintNumber(
|
||||||
existingSprintNumbers.length > 0 ? existingSprintNumbers.at(-1) : null
|
existingSprintNumbers.length > 0 ? existingSprintNumbers.at(-1) : null
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}, [allSprints])
|
}, [allSprints])
|
||||||
|
|
||||||
const handleSubmit = async (date, time, description, tags) => {
|
const handleSubmit = async (date, time, description, tags) => {
|
||||||
|
|||||||
@@ -5,7 +5,12 @@ import { Typography } from '@material-ui/core'
|
|||||||
import topicFormPageActions from '../reducers/actions/topicFormPageActions'
|
import topicFormPageActions from '../reducers/actions/topicFormPageActions'
|
||||||
import './TopicFormPageInfo.css'
|
import './TopicFormPageInfo.css'
|
||||||
|
|
||||||
const TopicFormPageInfo = ({ topicOpen, topicMessage, updateShowInfo, toggle }) => {
|
const TopicFormPageInfo = ({
|
||||||
|
topicOpen,
|
||||||
|
topicMessage,
|
||||||
|
updateShowInfo,
|
||||||
|
toggle,
|
||||||
|
}) => {
|
||||||
const allowCretion = topicOpen && toggle
|
const allowCretion = topicOpen && toggle
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -30,26 +35,25 @@ const TopicFormPageInfo = ({ topicOpen, topicMessage, updateShowInfo, toggle })
|
|||||||
{!allowCretion && (
|
{!allowCretion && (
|
||||||
<div className="topic-form-page-info-message">{topicMessage}</div>
|
<div className="topic-form-page-info-message">{topicMessage}</div>
|
||||||
)}
|
)}
|
||||||
{false && <span style={{ margin: 10, color: 'white' }} onClick={() => updateShowInfo(false)}>.</span>}
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapStateToProps = (state) => {
|
const mapStateToProps = (state) => {
|
||||||
return {
|
return {
|
||||||
toggle: true || state && state.login && state.login.user && state.login.user.user && state.login.user.user.username === 'mluukkai2',
|
toggle: true,
|
||||||
topicOpen: state.registrationManagement.topicRegistrationOpen,
|
topicOpen: state.registrationManagement.topicRegistrationOpen,
|
||||||
topicMessage: state.registrationManagement.topicRegistrationMessage
|
topicMessage: state.registrationManagement.topicRegistrationMessage,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapDispatchToProps = {
|
const mapDispatchToProps = {
|
||||||
...topicFormPageActions
|
...topicFormPageActions,
|
||||||
}
|
}
|
||||||
|
|
||||||
const ConnectedTopicFormPageInfo = connect(
|
const ConnectedTopicFormPageInfo = connect(
|
||||||
mapStateToProps,
|
mapStateToProps,
|
||||||
mapDispatchToProps
|
mapDispatchToProps,
|
||||||
)(TopicFormPageInfo)
|
)(TopicFormPageInfo)
|
||||||
|
|
||||||
export default ConnectedTopicFormPageInfo
|
export default ConnectedTopicFormPageInfo
|
||||||
|
|||||||
@@ -19,13 +19,11 @@ const customTheme = createMuiTheme({
|
|||||||
overline: {
|
overline: {
|
||||||
color: 'darkOrange',
|
color: 'darkOrange',
|
||||||
},
|
},
|
||||||
|
useNextVariants: true,
|
||||||
},
|
},
|
||||||
link: {
|
link: {
|
||||||
color: 'darkOrange',
|
color: 'darkOrange',
|
||||||
},
|
},
|
||||||
typography: {
|
|
||||||
useNextVariants: true,
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const TopicDetailsLink = ({ topicId, ...props }) => (
|
const TopicDetailsLink = ({ topicId, ...props }) => (
|
||||||
|
|||||||
Reference in New Issue
Block a user