Commit f4a2b0c8 authored by jtimotei's avatar jtimotei

Fixed lint errors

parent 5f26061a
Pipeline #18051 passed with stages
in 3 minutes and 8 seconds
......@@ -63,15 +63,15 @@ class Exams extends React.Component {
previewing: false
}
}
if(prevState.problemIdToEditFeedbackOf && !prevState.editActive) {
if(prevState.waitForNextRender) {
if (prevState.problemIdToEditFeedbackOf && !prevState.editActive) {
if (prevState.waitForNextRender) {
var problem = newProps.exam.problems.find(w => {
return w.widget.id == prevState.problemIdToEditFeedbackOf
return w.widget.id === prevState.problemIdToEditFeedbackOf
})
prevState.widgets[problem.widget.id].problem.feedback = problem.feedback
prevState.waitForNextRender = false
if(!prevState.editActive) prevState.problemIdToEditFeedbackOf = null
} else prevState.waitForNextRender = true
if (!prevState.editActive) prevState.problemIdToEditFeedbackOf = null
} else prevState.waitForNextRender = true
}
return prevState
}
......@@ -85,7 +85,7 @@ class Exams extends React.Component {
if (prevState.selectedWidgetId !== this.state.selectedWidgetId) {
this.saveProblemName()
this.setState({
editActive:false,
editActive: false,
problemIdToEditFeedbackOf: false
})
}
......@@ -343,19 +343,19 @@ class Exams extends React.Component {
props.saveProblemName(e.target.value)
}} />
</div>
<br/>
<br />
{!this.state.editActive && <label className='label'>Feedback options</label>}
</React.Fragment>
)}
</div>
</div>
{this.isProblemWidget(selectedWidgetId) && (this.state.editActive
? <EditPanel problemID={props.problem.id} feedback={this.state.feedbackToEdit}
goBack={this.backToFeedback} />
: <FeedbackPanel examID={this.props.examID} problem={props.problem}
editFeedback={this.editFeedback} showTooltips={this.state.showTooltips}
grading={false}
/>)}
? <EditPanel problemID={props.problem.id} feedback={this.state.feedbackToEdit}
goBack={this.backToFeedback} />
: <FeedbackPanel examID={this.props.examID} problem={props.problem}
editFeedback={this.editFeedback} showTooltips={this.state.showTooltips}
grading={false}
/>)}
<div className='panel-block'>
<button
disabled={props.disabledDelete}
......
......@@ -13,11 +13,11 @@ def test_exam_generate_token_length_uppercase(duplicate_count, monkeypatch):
self.duplicates = duplicate_count + 1
def filter(self, *args):
return self
return self
def first(self):
self.duplicates -= 1
return None if self.duplicates else True
self.duplicates -= 1
return None if self.duplicates else True
app = Flask(__name__, static_folder=None)
app.config.update(
......
......@@ -57,27 +57,27 @@ def render_email(exam_id, student_id, template):
def build_email(exam_id, student_id, template, attach, from_address, copy_to=None):
student = Student.query.get(student_id)
if student is None:
abort(
404,
message=f"Student #{student_id} does not exist"
)
if not student.email:
abort(
409,
message=f'Student #{student_id} has no email address'
)
return emails.build(
student.email,
render_email(exam_id, student_id, template),
emails.build_solution_attachment(exam_id, student_id)
if attach
else None,
copy_to=copy_to,
email_from=from_address,
student = Student.query.get(student_id)
if student is None:
abort(
404,
message=f"Student #{student_id} does not exist"
)
if not student.email:
abort(
409,
message=f'Student #{student_id} has no email address'
)
return emails.build(
student.email,
render_email(exam_id, student_id, template),
emails.build_solution_attachment(exam_id, student_id)
if attach
else None,
copy_to=copy_to,
email_from=from_address,
)
class EmailTemplate(Resource):
......
......@@ -103,7 +103,7 @@ def send(
server_type = smtplib.SMTP_SSL if use_ssl else smtplib.SMTP
with server_type(server, port) as s:
if user and password:
s.login(user, password)
s.login(user, password)
for identifier, message in messages.items():
recipients = [
*message['To'].split(','),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment