Skip to content
Snippets Groups Projects
Commit d342d56d authored by Hidde Leistra's avatar Hidde Leistra
Browse files

Merge branch 'feature/premade-feedback' of...

Merge branch 'feature/premade-feedback' of ssh://gitlab.kwant-project.org:443/works-on-my-machine/zesje into feature/premade-feedback
parents f85b1a99 f4a2b0c8
No related branches found
No related tags found
3 merge requests!26Premade feedback merge,!24Master->develop (this MR contains no useful information),!23WIP: Highlight feedback
...@@ -63,15 +63,15 @@ class Exams extends React.Component { ...@@ -63,15 +63,15 @@ class Exams extends React.Component {
previewing: false previewing: false
} }
} }
if(prevState.problemIdToEditFeedbackOf && !prevState.editActive) { if (prevState.problemIdToEditFeedbackOf && !prevState.editActive) {
if(prevState.waitForNextRender) { if (prevState.waitForNextRender) {
var problem = newProps.exam.problems.find(w => { 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.widgets[problem.widget.id].problem.feedback = problem.feedback
prevState.waitForNextRender = false prevState.waitForNextRender = false
if(!prevState.editActive) prevState.problemIdToEditFeedbackOf = null if (!prevState.editActive) prevState.problemIdToEditFeedbackOf = null
} else prevState.waitForNextRender = true } else prevState.waitForNextRender = true
} }
return prevState return prevState
} }
...@@ -85,7 +85,7 @@ class Exams extends React.Component { ...@@ -85,7 +85,7 @@ class Exams extends React.Component {
if (prevState.selectedWidgetId !== this.state.selectedWidgetId) { if (prevState.selectedWidgetId !== this.state.selectedWidgetId) {
this.saveProblemName() this.saveProblemName()
this.setState({ this.setState({
editActive:false, editActive: false,
problemIdToEditFeedbackOf: false problemIdToEditFeedbackOf: false
}) })
} }
...@@ -343,19 +343,19 @@ class Exams extends React.Component { ...@@ -343,19 +343,19 @@ class Exams extends React.Component {
props.saveProblemName(e.target.value) props.saveProblemName(e.target.value)
}} /> }} />
</div> </div>
<br/> <br />
{!this.state.editActive && <label className='label'>Feedback options</label>} {!this.state.editActive && <label className='label'>Feedback options</label>}
</React.Fragment> </React.Fragment>
)} )}
</div> </div>
</div> </div>
{this.isProblemWidget(selectedWidgetId) && (this.state.editActive {this.isProblemWidget(selectedWidgetId) && (this.state.editActive
? <EditPanel problemID={props.problem.id} feedback={this.state.feedbackToEdit} ? <EditPanel problemID={props.problem.id} feedback={this.state.feedbackToEdit}
goBack={this.backToFeedback} /> goBack={this.backToFeedback} />
: <FeedbackPanel examID={this.props.examID} problem={props.problem} : <FeedbackPanel examID={this.props.examID} problem={props.problem}
editFeedback={this.editFeedback} showTooltips={this.state.showTooltips} editFeedback={this.editFeedback} showTooltips={this.state.showTooltips}
grading={false} grading={false}
/>)} />)}
<div className='panel-block'> <div className='panel-block'>
<button <button
disabled={props.disabledDelete} disabled={props.disabledDelete}
......
...@@ -13,11 +13,11 @@ def test_exam_generate_token_length_uppercase(duplicate_count, monkeypatch): ...@@ -13,11 +13,11 @@ def test_exam_generate_token_length_uppercase(duplicate_count, monkeypatch):
self.duplicates = duplicate_count + 1 self.duplicates = duplicate_count + 1
def filter(self, *args): def filter(self, *args):
return self return self
def first(self): def first(self):
self.duplicates -= 1 self.duplicates -= 1
return None if self.duplicates else True return None if self.duplicates else True
app = Flask(__name__, static_folder=None) app = Flask(__name__, static_folder=None)
app.config.update( app.config.update(
......
...@@ -57,27 +57,27 @@ def render_email(exam_id, student_id, template): ...@@ -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): def build_email(exam_id, student_id, template, attach, from_address, copy_to=None):
student = Student.query.get(student_id) student = Student.query.get(student_id)
if student is None: if student is None:
abort( abort(
404, 404,
message=f"Student #{student_id} does not exist" 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,
) )
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): class EmailTemplate(Resource):
......
...@@ -103,7 +103,7 @@ def send( ...@@ -103,7 +103,7 @@ def send(
server_type = smtplib.SMTP_SSL if use_ssl else smtplib.SMTP server_type = smtplib.SMTP_SSL if use_ssl else smtplib.SMTP
with server_type(server, port) as s: with server_type(server, port) as s:
if user and password: if user and password:
s.login(user, password) s.login(user, password)
for identifier, message in messages.items(): for identifier, message in messages.items():
recipients = [ recipients = [
*message['To'].split(','), *message['To'].split(','),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment