CHRISDANIEL145 commited on
Commit
28e6b7f
·
1 Parent(s): dc4ebce

Fix results display - hide hero section and add fallback assessment data

Browse files
Files changed (1) hide show
  1. static/assets/js/premium-app.js +29 -5
static/assets/js/premium-app.js CHANGED
@@ -794,11 +794,25 @@ function showAllUIAfterExam() {
794
 
795
  // Show results
796
  function showResults() {
797
- // Hide interview section and show results section on the same page
 
 
798
  document.getElementById('interviewSection')?.classList.add('hidden');
799
  document.getElementById('setupSection')?.classList.add('hidden');
800
  document.getElementById('uploadSection')?.classList.add('hidden');
801
- document.getElementById('resultsSection')?.classList.remove('hidden');
 
 
 
 
 
 
 
 
 
 
 
 
802
 
803
  // Display assessment
804
  const assessment = JSON.parse(sessionStorage.getItem('assessment') || '{}');
@@ -807,10 +821,20 @@ function showResults() {
807
  console.log('Assessment:', assessment);
808
  console.log('Responses:', responses);
809
 
810
- // Check if we have assessment data
811
  if (!assessment || typeof assessment.overallScore === 'undefined') {
812
- showAlert('No assessment data available', 'error');
813
- return;
 
 
 
 
 
 
 
 
 
 
814
  }
815
 
816
  // Update overall score (handle 0 as valid score)
 
794
 
795
  // Show results
796
  function showResults() {
797
+ console.log('showResults called');
798
+
799
+ // Hide ALL other sections
800
  document.getElementById('interviewSection')?.classList.add('hidden');
801
  document.getElementById('setupSection')?.classList.add('hidden');
802
  document.getElementById('uploadSection')?.classList.add('hidden');
803
+
804
+ // Also hide hero section
805
+ const hero = document.querySelector('.hero-section');
806
+ if (hero) hero.style.display = 'none';
807
+
808
+ // Show results section
809
+ const resultsSection = document.getElementById('resultsSection');
810
+ if (resultsSection) {
811
+ resultsSection.classList.remove('hidden');
812
+ resultsSection.style.display = 'block';
813
+ // Scroll to results
814
+ resultsSection.scrollIntoView({ behavior: 'smooth', block: 'start' });
815
+ }
816
 
817
  // Display assessment
818
  const assessment = JSON.parse(sessionStorage.getItem('assessment') || '{}');
 
821
  console.log('Assessment:', assessment);
822
  console.log('Responses:', responses);
823
 
824
+ // If no assessment data, create fallback from responses
825
  if (!assessment || typeof assessment.overallScore === 'undefined') {
826
+ console.log('No assessment data, creating fallback');
827
+ if (responses.length > 0) {
828
+ const avgScore = responses.reduce((sum, r) => sum + (r.evaluation?.score || 0), 0) / responses.length;
829
+ assessment.overallScore = Math.round(avgScore);
830
+ assessment.recommendation = avgScore >= 70 ? 'Recommended' : 'Needs Improvement';
831
+ assessment.detailedScores = { technicalSkills: Math.round(avgScore), communication: Math.round(avgScore), softSkills: Math.round(avgScore) };
832
+ assessment.keyStrengths = ['Completed all questions'];
833
+ assessment.areasForImprovement = ['Review detailed feedback'];
834
+ } else {
835
+ showAlert('No assessment data available', 'error');
836
+ return;
837
+ }
838
  }
839
 
840
  // Update overall score (handle 0 as valid score)