From 997346086d082f2ae40d6356405f360dc3c1e93b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Janis=20Daniel=20Da=CC=88hne?=
 <janis.daehne2@student.uni-halle.de>
Date: Tue, 14 Jan 2020 20:29:01 +0100
Subject: [PATCH] - temporary test results are now displayed again for
 submissions - added check for first login page (set password) to ensure there
 is an tid

---
 i18n/en.ts                                         |  4 ++--
 i18n/i18nRoot.ts                                   |  4 ++--
 .../submissionsSite/listView.tsx                   | 10 ++++++----
 .../manualAssessmentPanelView.tsx                  |  6 ++++--
 src/helpers/convertersAndTransformers.ts           |  5 +++--
 .../firstLoginExternalLogin.ts                     | 14 ++++++++++++++
 webpack.config.dist.js                             |  4 ++--
 7 files changed, 33 insertions(+), 14 deletions(-)

diff --git a/i18n/en.ts b/i18n/en.ts
index 1be0b270..d266faa6 100644
--- a/i18n/en.ts
+++ b/i18n/en.ts
@@ -603,8 +603,8 @@ export const lang_en: LangObj = {
   "You can import the .csv file from the 'download all submissions' feature here. At least the columns UserId, PLangId, ManualPoints, NoteForOtherTutors, FeedbackForStudent are needed. The columns ManualPoints, NoteForOtherTutors, FeedbackForStudent are used to overwrite the values in the backend. The first line must be a comment (starting with #) containing the release code. If the upload was successful then the view is automatically refreshed": "You can import the .csv file from the 'download all submissions' feature here. At least the columns UserId, PLangId, ManualPoints, NoteForOtherTutors, FeedbackForStudent are needed. The columns ManualPoints, NoteForOtherTutors, FeedbackForStudent are used to overwrite the values in the backend. The first line must be a comment (starting with #) containing the release code. If the upload was successful then the view is automatically refreshed",
   "Re-run automatic assessments": "Re-run automatic assessments",
   "This re-runs all submit tests (and normal tests if specified in the release) and preserves the manual points and comments (for student, other tutors). This is also the case for single re-run.": "This re-runs all submit tests (and normal tests if specified in the release) and preserves the manual points and comments (for student, other tutors). This is also the case for single re-run.",
-  "The summed normal test points. The percentage represent the students where all normal tests passed and the participation should count. If nothing is displayed none normal test was run yet.": "The summed normal test points. The percentage represent the students where all normal tests passed and the participation should count. If nothing is displayed none normal test was run yet.",
-  "The summed submit test points. The percentage represent the students where all submit tests passed and the participation should count. If nothing is displayed none submit test was run yet.": "The summed submit test points. The percentage represent the students where all submit tests passed and the participation should count. If nothing is displayed none submit test was run yet.",
+  "The summed normal test points. The percentage represent the students where all normal tests passed and the participation should count. If the auto assessment was not run/finished yet the sum of positive tests are displayed (only the test that the user actually executed).": "The summed normal test points. The percentage represent the students where all normal tests passed and the participation should count. If the auto assessment was not run/finished yet the sum of positive tests are displayed (only the test that the user actually executed).",
+  "The summed submit test points. The percentage represent the students where all submit tests passed and the participation should count. If the auto assessment was not run/finished yet the sum of positive tests are displayed (only the test that the user actually executed).": "The summed submit test points. The percentage represent the students where all submit tests passed and the participation should count. If the auto assessment was not run/finished yet the sum of positive tests are displayed (only the test that the user actually executed).",
   "with all points" : "with all points",
   "Download": "Download",
   "Re-run": "Re-run",
diff --git a/i18n/i18nRoot.ts b/i18n/i18nRoot.ts
index e6638161..202488be 100644
--- a/i18n/i18nRoot.ts
+++ b/i18n/i18nRoot.ts
@@ -608,8 +608,8 @@ export interface LangObj {
   "You can import the .csv file from the 'download all submissions' feature here. At least the columns UserId, PLangId, ManualPoints, NoteForOtherTutors, FeedbackForStudent are needed. The columns ManualPoints, NoteForOtherTutors, FeedbackForStudent are used to overwrite the values in the backend. The first line must be a comment (starting with #) containing the release code. If the upload was successful then the view is automatically refreshed": string
   "Re-run automatic assessments": string
   "This re-runs all submit tests (and normal tests if specified in the release) and preserves the manual points and comments (for student, other tutors). This is also the case for single re-run.": string
-  "The summed normal test points. The percentage represent the students where all normal tests passed and the participation should count. If nothing is displayed none normal test was run yet.": string
-  "The summed submit test points. The percentage represent the students where all submit tests passed and the participation should count. If nothing is displayed none submit test was run yet.": string
+  "The summed normal test points. The percentage represent the students where all normal tests passed and the participation should count. If the auto assessment was not run/finished yet the sum of positive tests are displayed (only the test that the user actually executed).": string
+  "The summed submit test points. The percentage represent the students where all submit tests passed and the participation should count. If the auto assessment was not run/finished yet the sum of positive tests are displayed (only the test that the user actually executed).": string
   "with all points": string
   "Download": string
   "Re-run": string
diff --git a/src/components/sites/manageOwnOrGroupExerciseComponents/submissionsSite/listView.tsx b/src/components/sites/manageOwnOrGroupExerciseComponents/submissionsSite/listView.tsx
index a478be15..2c8dfa57 100644
--- a/src/components/sites/manageOwnOrGroupExerciseComponents/submissionsSite/listView.tsx
+++ b/src/components/sites/manageOwnOrGroupExerciseComponents/submissionsSite/listView.tsx
@@ -309,7 +309,7 @@ class ListView extends React.Component<Props, any> {
                 >
                   <HelpPopup wide icon="flag"
                              defaultText={getI18n(this.props.langId,
-                                                  'The summed normal test points. The percentage represent the students where all normal tests passed and the participation should count. If nothing is displayed none normal test was run yet.'
+                                                  'The summed normal test points. The percentage represent the students where all normal tests passed and the participation should count. If the auto assessment was not run/finished yet the sum of positive tests are displayed (only the test that the user actually executed).'
                              )}/>
 
                   {
@@ -353,7 +353,7 @@ class ListView extends React.Component<Props, any> {
                 >
                   <HelpPopup wide icon="flag checkered"
                              defaultText={getI18n(this.props.langId,
-                                                  'The summed submit test points. The percentage represent the students where all submit tests passed and the participation should count. If nothing is displayed none submit test was run yet.'
+                                                  'The summed submit test points. The percentage represent the students where all submit tests passed and the participation should count. If the auto assessment was not run/finished yet the sum of positive tests are displayed (only the test that the user actually executed).'
                              )}/>
 
                   {
@@ -527,7 +527,8 @@ class ListView extends React.Component<Props, any> {
                                                    this.props.release.hasAutomaticAssessmentFinished,
                                                    false,
                                                    submission.normalTestPoints,
-                                                   submission.maxNormalTestPoints
+                                                   submission.maxNormalTestPoints,
+                                                   true
                           )
                         }
                       </span>
@@ -540,7 +541,8 @@ class ListView extends React.Component<Props, any> {
                                                    this.props.release.hasAutomaticAssessmentFinished,
                                                    false,
                                                    submission.submitTestPoints,
-                                                   submission.maxSubmitTestPoints
+                                                   submission.maxSubmitTestPoints,
+                                                   true
                           )
                         }
                       </span>
diff --git a/src/components/sites/tutorViewSite/manualAssessmentPanel/manualAssessmentPanelView.tsx b/src/components/sites/tutorViewSite/manualAssessmentPanel/manualAssessmentPanelView.tsx
index a4565119..64438627 100644
--- a/src/components/sites/tutorViewSite/manualAssessmentPanel/manualAssessmentPanelView.tsx
+++ b/src/components/sites/tutorViewSite/manualAssessmentPanel/manualAssessmentPanelView.tsx
@@ -69,13 +69,15 @@ class manualAssessmentPanelView extends React.Component<Props, any> {
                                                             this.props.release.hasAutomaticAssessmentFinished,
                                                             this.props.assessment.hasAssessment === false,
                                                             this.props.assessment.submitTestPoints,
-                                                            this.props.assessment.maxSubmitTestPoints)
+                                                            this.props.assessment.maxSubmitTestPoints,
+                                                            false)
 
     const normalTestPointsString = assessmentPointsToString(this.props.langId,
                                                             this.props.release.hasAutomaticAssessmentFinished,
                                                             this.props.assessment.hasAssessment === false,
                                                             this.props.assessment.normalTestPoints,
-                                                            this.props.assessment.maxNormalTestPoints)
+                                                            this.props.assessment.maxNormalTestPoints,
+                                                            false)
 
     return (
       <div className="fh mar-right-half">
diff --git a/src/helpers/convertersAndTransformers.ts b/src/helpers/convertersAndTransformers.ts
index 7bac4f51..1ef42911 100644
--- a/src/helpers/convertersAndTransformers.ts
+++ b/src/helpers/convertersAndTransformers.ts
@@ -1073,14 +1073,15 @@ function trimStart(text: string): string {
  * @param assessmentIsEmpty {@link AssessmentFullBase.hasAssessment} ?
  * @param testPoints
  * @param maxTestPoints
+ * @param ignoreHasAssessmentFinished true: param {@link hasAutomaticAssessmentFinished} is ignored, false: not
  */
-export function assessmentPointsToString(langId: KnownLangs, hasAutomaticAssessmentFinished: boolean, assessmentIsEmpty: boolean, testPoints: number | null, maxTestPoints: number | null): string {
+export function assessmentPointsToString(langId: KnownLangs, hasAutomaticAssessmentFinished: boolean, assessmentIsEmpty: boolean, testPoints: number | null, maxTestPoints: number | null, ignoreHasAssessmentFinished: boolean): string {
 
   if (assessmentIsEmpty) {
     return getI18n(langId, 'Not assessed')
   }
 
-  if (hasAutomaticAssessmentFinished === false) {
+  if (ignoreHasAssessmentFinished === false && hasAutomaticAssessmentFinished === false) {
     return getI18n(langId, 'Not assessed')
   }
 
diff --git a/static_pages/firstExternalLoginPage/firstLoginExternalLogin.ts b/static_pages/firstExternalLoginPage/firstLoginExternalLogin.ts
index dbae1796..3eab95cd 100644
--- a/static_pages/firstExternalLoginPage/firstLoginExternalLogin.ts
+++ b/static_pages/firstExternalLoginPage/firstLoginExternalLogin.ts
@@ -6,6 +6,20 @@
 
 declare var CryptoJS:any;
 
+
+function onpageLoad()  {
+
+  const tid = getParameterByName('tid')
+
+  if (tid === null || tid === '') {
+    alert("Error: tid is missing.")
+
+    const registerBtn = document.getElementById('registerButton')
+    registerBtn.setAttribute("disabled", "true")
+  }
+}
+window.onload = onpageLoad
+
 function getParameterByName(name: string, url?: string) {
   if (!url) url = window.location.href;
   name = name.replace(/[\[\]]/g, "\\$&");
diff --git a/webpack.config.dist.js b/webpack.config.dist.js
index 880c9941..b504062c 100644
--- a/webpack.config.dist.js
+++ b/webpack.config.dist.js
@@ -159,11 +159,11 @@ module.exports = {
       },
       //--- copy also static pages & assets
       {
-        from: 'static_pages/static/robots.txt',
+        from: 'static_pages/just_copy/robots.txt',
         to: 'robots.txt',
       },
       {
-        from: 'static_pages/static/sitemap.xml',
+        from: 'static_pages/just_copy/sitemap.xml',
         to: 'sitemap.xml',
       },
       {
-- 
GitLab