Chingu-cohorts / devgaido

Chingu Learning Path application
https://devgaido.com
MIT License
25 stars 3 forks source link

Inconsistent messages on screenshot failure #125

Closed jdmedlock closed 7 years ago

jdmedlock commented 7 years ago

Issue Description & Expected Outcome: When generating a screenshot messages are generated indicating that the production of a screenshot is successful and unsuccessful and the screenshot .jpg is not generated. The expected outcome is for the success message to be generated if the screenshot jpg file was created or the failure message to be generated if it could not be generated. One or the other message should be emitted, but not both.

Symptoms:

jimmedlock@Merry devgaido 🤓: yarn screenshots algorithms1
yarn screenshots v0.27.5
$ node ./src/server/screenshots "algorithms1"
Couldn't take screenshot of algorithms1 https://www.coursera.org/learn/introduction-to-algorithms
Successfully created 1 screenshots.
Unsuccessful:  1
algorithms1
Done in 6.43s.
jimmedlock@Merry devgaido 🤓: 

Steps to Recreate: From a terminal session enter yarn screenshots algorithms1

Resolution: Resolved with changes to generateShot.js

jdmedlock commented 7 years ago

The issue is lies in generateShots.js in this code:

  } else {
    console.log('Successfully created', count, 'screenshots.');
    console.log('Unsuccessful: ', errors.length);
    errors.forEach((errLessonId) => {
      console.log(errLessonId);
    });
  }

The success message should replaced with:

console.log('Attempted to create', count, 'screenshots.');
console.log('Successfully created', count - errors.length, 'screenshots.');