Allow teacher to mark as graded when something is completed.

This commit is contained in:
Tim Young 2017-08-12 16:58:41 -05:00
parent 6fbaf98299
commit 71f43c4f24
4 changed files with 48 additions and 11 deletions

View File

@ -912,14 +912,30 @@ namespace EduNetworkBuilder
}
else
{
//It was homework. Ask if we want to submit it.
DialogResult answer = MessageBox.Show(NB.Translate("N_PromptToSubmit"), NB.Translate("_Solved"), MessageBoxButtons.YesNo);
if (answer == DialogResult.Yes)
PersonClass CurrentUser = NB.GetUser();
if (CurrentUser != null && CurrentUser.isAdmin)
{
KillAllExtraWindows(true);
BuilderWindow BW = NB.GetBuilderWin();
BW.SubmitHomework();
//It was homework. Ask if we want to submit it.
DialogResult answer = MessageBox.Show(NB.Translate("N_PromptToGrade"), NB.Translate("_Solved"), MessageBoxButtons.YesNo);
if (answer == DialogResult.Yes)
{
KillAllExtraWindows(true);
BuilderWindow BW = NB.GetBuilderWin();
BW.MarkAsGraded();
}
}
else
{
//It was homework. Ask if we want to submit it.
DialogResult answer = MessageBox.Show(NB.Translate("N_PromptToSubmit"), NB.Translate("_Solved"), MessageBoxButtons.YesNo);
if (answer == DialogResult.Yes)
{
KillAllExtraWindows(true);
BuilderWindow BW = NB.GetBuilderWin();
BW.SubmitHomework();
}
}
}
}

View File

@ -2088,7 +2088,8 @@ namespace EduNetworkBuilder
SubmitHomework();
}
private void markAsGradedToolStripMenuItem_Click(object sender, EventArgs e)
public void MarkAsGraded()
{
if (myNetwork.WhatFrom == null) return; //We cannot submit it
@ -2102,6 +2103,11 @@ namespace EduNetworkBuilder
UpdateMenu();
}
private void markAsGradedToolStripMenuItem_Click(object sender, EventArgs e)
{
MarkAsGraded();
}
private void logoutToolStripMenuItem_Click(object sender, EventArgs e)
{
if (CurrentUser == null) return; //Nobody to logout

View File

@ -516,6 +516,7 @@ namespace EduNetworkBuilder
List<SchoolworkClass> DrawFrom = new List<SchoolworkClass>();
List<SchoolworkClass> MasterList = new List<SchoolworkClass>();
bool SomethingWasBolded = false; //Set this to true if we make something bold
DrawFrom.AddRange(Projects);
for (int i = DrawFrom.Count - 1; i >= 0; i--)
@ -541,9 +542,12 @@ namespace EduNetworkBuilder
{
Top = theTop;
}
foreach(SchoolworkClass MasterSW in MasterList)
Font tFont = NB.GetFont();
foreach (SchoolworkClass MasterSW in MasterList)
{
int count = 0;
int ungraded = 0;
Master = new TreeNode(MasterSW.Name);
Master.Tag = MasterSW;
@ -556,20 +560,27 @@ namespace EduNetworkBuilder
Master.Nodes.Add(Node);
if (ForTeacher && !DrawFrom[i].IsGraded) //Bold ungraded homework
{
Font tFont = NB.GetFont();
Node.NodeFont = new Font(tFont.FontFamily, tFont.Size, FontStyle.Bold);
SomethingWasBolded = true;
ungraded++;
}
count++; //How many submitted versions are there
}
}
if(!ForTeacher && count ==0) //bold homework that has not yet been submitted
{
Font tFont = NB.GetFont();
Master.NodeFont = new Font(tFont.FontFamily, tFont.Size, FontStyle.Bold);
SomethingWasBolded = true;
} else if(ForTeacher && ungraded > 0) //If we have ungraded submissions
{
Master.NodeFont = new Font(tFont.FontFamily, tFont.Size, FontStyle.Bold);
SomethingWasBolded = true;
}
Top.Nodes.Add(Master);
}
if(ForTeacher && SomethingWasBolded)
Top.NodeFont = new Font(tFont.FontFamily, tFont.Size, FontStyle.Bold);
return Top;
}

View File

@ -1901,6 +1901,10 @@
<value>Unable to load user {0} : No such account found. No password available to decrypt account.</value>
<comment>NB_TeacherUnableToLoadUserNoAcct = Unable to load user {0} : No such account found. No password available to decrypt account.</comment>
</data>
<data name="N_PromptToGrade" xml:space="preserve">
<value>The homework has passed all the tests. Would you like to Mark it as graded? If you want to keep wotking with it, click No. Go to "Edit" -&gt; "Mark as graded" when ready.</value>
<comment>N_PromptToGrade = The homework has passed all the tests. Would you like to Mark it as graded? If you want to keep wotking with it, click No. Go to "Edit" -&gt; "Mark as graded" when ready.</comment>
</data>
<data name="N_PromptToSubmit" xml:space="preserve">
<value>You have completed the homework. Would you like to submit it? If you want to clean it up and submit later, click No. Go to "Edit" -&gt; "Submit" when you want to submit it.</value>
<comment>N_PromptToSubmit = You have completed the homework. Would you like to submit it? If you want to clean it up and submit later, click No. Go to "Edit" -&gt; "Submit" when you want to submit it.</comment>