<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none"><!-- p { margin-top: 0px; margin-bottom: 0px; }--></style>
</head>
<body dir="ltr" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p></p>
Thanks for the enlightening response, as always! That&nbsp;approach makes <em>a lot </em>
of&nbsp;sense! I can definitely think of&nbsp;uses for hooks like that.<br>
<br>
(For this specific feature,&nbsp;I would&nbsp;prefer for&nbsp;something&nbsp;to be&nbsp;manual, since I tend to click Submit repeatedly before actually being ready to email, and I sometimes want to add extra text to the email. Not sure if those are common workflows though, and&nbsp;a hooks-based
 approach&nbsp;would let each class customize this anyway.)
<div><br>
Thanks!<br>
Valerie<br>
<br>
________________________________________<br>
From: adam j hartz &lt;hz@mit.edu&gt;<br>
Sent: Tuesday, July 9, 2019 10:25 AM<br>
To: Valerie G Richmond<br>
Cc: catsoop-dev; boning@mtl.mit.edu<br>
Subject: Re: [catsoop-dev] Button to Generate Email Notification of Manual Grade<br>
<br>
Hi Valerie,<br>
<br>
Thanks for sending this!<br>
<br>
&gt; I've been using this email-generating button, since students in 6.s090<br>
&gt; requested to be notified when their submissions are manually graded.<br>
&gt; It only appears if the course's preload.py has a variable<br>
&gt; cs_show_grade_email_generate_button set to True.<br>
<br>
I like this idea a lot, but I think we may want to find a more general<br>
way to implement this (and open the door to other, similar kinds of<br>
interactions) if we're going to include it in CAT-SOOP itself.<br>
<br>
>From a high-level perspective, I think my preference for generalizing<br>
this idea would be to add a number of additional hooks into the system<br>
to handle cases like this.&nbsp; Right now, CAT-SOOP provides hooks at<br>
various points in the page loading process, and those hooks allow<br>
plugins to run code at those points.&nbsp; I think adding hooks related to<br>
other kinds of events (student submits a question, a manual grade is<br>
entered, a question's grader finishes, user logs in, etc) would be a<br>
general way to offer these kinds of event-driven functionalities.<br>
<br>
In that view, the code for sending e-mail in response to manual grade<br>
entry would live in a plugin, and the CAT-SOOP codebase would only<br>
contain the most general stuff (i.e., code that triggers a<br>
&quot;manual_grade_entered&quot; hook after a manual grade has been entered, or<br>
something like that).<br>
<br>
<br>
In a bit more detail, what I would envision here would be something<br>
along the lines of adding a call like:<br>
<br>
&nbsp;&nbsp; loader.run_plugins(context, context[&quot;cs_course&quot;],<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;manual_grade_entered&quot;, context)<br>
<br>
to the bottom of the handle_grade function in the default handler.&nbsp; Then<br>
I would put the code for actually sending the e-mail in<br>
__PLUGINS__/email/manual_grade_entered.py within your course.&nbsp; Within<br>
that file, I would use the catsoop.mail.internal_message function to<br>
send the student an e-mail (which avoids the need for manual<br>
intervention, and which also avoids the extra complication that not<br>
everyone's e-mail address will have the form &lt;username&gt;@mit.edu).<br>
<br>
We could also then think about other places we would want to add these<br>
kinds of hooks into the system.<br>
<br>
<br>
My high-level hope is to provide the flexibility to implement these<br>
kinds of really nice modifications without requiring anyone to touch the<br>
code of CAT-SOOP itself (even if we can't predict the details of what<br>
those modifications will be for future users).&nbsp; I think adding these<br>
kinds of hooks, along with some other additions to the plugin system<br>
that I've been discussing with Ike and Duane, could really be a big<br>
improvement in that department.<br>
<br>
Happy to continue the conversation.<br>
<br>
Thanks again!<br>
-Adam<br>
</div>
</body>
</html>