From 6fbaf982996570c589a8f91881d3379ff27b21c5 Mon Sep 17 00:00:00 2001 From: Tim Young Date: Sat, 12 Aug 2017 16:31:56 -0500 Subject: [PATCH] Finish importing one student file if we are a teacher and open a student file. --- EduNetworkBuilder/NetworkBuilder.cs | 18 ++++++++++++++++++ EduNetworkBuilder/PersonClass.cs | 3 ++- .../Resources/languages/edustrings.resx | 12 ++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/EduNetworkBuilder/NetworkBuilder.cs b/EduNetworkBuilder/NetworkBuilder.cs index 1ab4d45..b41058a 100644 --- a/EduNetworkBuilder/NetworkBuilder.cs +++ b/EduNetworkBuilder/NetworkBuilder.cs @@ -1785,10 +1785,28 @@ namespace EduNetworkBuilder else if(CurrentUser != null && CurrentUser.isAdmin) { //We want to import the student information for this one student + string user = Path.GetFileNameWithoutExtension(filename); //Dig up the corresponding user. + PersonClass CurrentStudentUser = CurrentUser.StudentWithTheUserName(user); + if(CurrentStudentUser == null) + { + //This means we do not have a user with that name in this class. + //More importantly, we do not have an alt-password set up so we can import them. + MessageBox.Show(string.Format(NB.Translate("NB_TeacherUnableToLoadUserNoAcct"),user)); + return; + } //Use the alt password for that user to load the file + PersonClass LoadedStudent = PersonClass.TryLoad(filename, CurrentStudentUser.AltPassword); + if (LoadedStudent == null) + { + //This means our password did not work + MessageBox.Show(string.Format(NB.Translate("NB_TeacherUnableToLoadUserInvalidPW"), user)); + return; + } //import their settings + int HomeworkImported = CurrentUser.TeacherImportStudentHomework(LoadedStudent); //messagebox to show what we are doing + MessageBox.Show(string.Format(NB.Translate("NB_TeacherSuccessImport"), HomeworkImported)); } } else if (extension == ".enbh") diff --git a/EduNetworkBuilder/PersonClass.cs b/EduNetworkBuilder/PersonClass.cs index 994f2f3..da2d238 100644 --- a/EduNetworkBuilder/PersonClass.cs +++ b/EduNetworkBuilder/PersonClass.cs @@ -614,7 +614,8 @@ namespace EduNetworkBuilder if (StoredStudent.RegisterNewlySubmittedHW(SWC)) { // copy them into the admin file - NumSubmitted++; + if(SWC.IsSumbitted) //Only report submitted homeworks back. + NumSubmitted++; } } return NumSubmitted; diff --git a/EduNetworkBuilder/Resources/languages/edustrings.resx b/EduNetworkBuilder/Resources/languages/edustrings.resx index d78f59a..ebcb9f4 100644 --- a/EduNetworkBuilder/Resources/languages/edustrings.resx +++ b/EduNetworkBuilder/Resources/languages/edustrings.resx @@ -1889,6 +1889,18 @@ Please log out before loading a new person file NB_LogOutFirst = Please log out before loading a new person file + + Successfully loaded the file. There were {0} new submissions. + NB_TeacherSuccessImport = Successfully loaded the file. There were {0} new submissions. + + + Unable to load user {0} : The password we have failed to open the file. Maybe this student was for a different teacher file? + NB_TeacherUnableToLoadUserInvalidPW = Unable to load user {0} : The password we have failed to open the file. Maybe this student was for a different teacher file? + + + Unable to load user {0} : No such account found. No password available to decrypt account. + NB_TeacherUnableToLoadUserNoAcct = Unable to load user {0} : No such account found. No password available to decrypt account. + 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" -> "Submit" when you want to submit it. 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" -> "Submit" when you want to submit it.