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 @@ <value>Please log out before loading a new person file</value> <comment>NB_LogOutFirst = Please log out before loading a new person file</comment> </data> + <data name="NB_TeacherSuccessImport" xml:space="preserve"> + <value>Successfully loaded the file. There were {0} new submissions.</value> + <comment>NB_TeacherSuccessImport = Successfully loaded the file. There were {0} new submissions.</comment> + </data> + <data name="NB_TeacherUnableToLoadUserInvalidPW" xml:space="preserve"> + <value>Unable to load user {0} : The password we have failed to open the file. Maybe this student was for a different teacher file?</value> + <comment>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?</comment> + </data> + <data name="NB_TeacherUnableToLoadUserNoAcct" xml:space="preserve"> + <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_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" -> "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" -> "Submit" when you want to submit it.</comment>