# codehs_grades

> This is a [NodeJS](https://nodejs.org/) tool using the [Puppeteer](https://developers.google.com/web/tools/puppeteer) headless browser to crawl the [CodeHS](https://codehs.com) code teaching platform for a teacher's students' grades.

Latest version **1.1.5** (published 2020-01-30) · ISC license · 0 weekly downloads

## Install

```sh
npm install codehs_grades
pnpm add codehs_grades
yarn add codehs_grades
bun add codehs_grades
```

Provides the command `codehs_grades`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.5 |
| Published | 2020-01-30 |
| First published | 2019-12-25 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 12 |
| Unpacked size | 78.9 KB |
| Known vulnerabilities | 0 (+4 in 1 direct dependencies) |
| Install scripts | no |
| Author | JP |
| Maintainers | randomdevd3v |

## Links

- npm: https://www.npmjs.com/package/codehs_grades
- npm.io page: https://npm.io/package/codehs_grades

## Dependencies (12)

- [ora](https://npm.io/package/ora.md) ^4.0.3
- [chalk](https://npm.io/package/chalk.md) latest
- [jsdom](https://npm.io/package/jsdom.md) ^15.2.1
- [mkdirp](https://npm.io/package/mkdirp.md) ^0.5.1
- [p-limit](https://npm.io/package/p-limit.md) ^2.2.1
- [prompts](https://npm.io/package/prompts.md) ^2.3.0
- [archiver](https://npm.io/package/archiver.md) ^3.1.1
- [puppeteer](https://npm.io/package/puppeteer.md) ^2.0.0
- [validator](https://npm.io/package/validator.md) ^12.1.0
- [bottleneck](https://npm.io/package/bottleneck.md) ^2.19.5
- [string-format](https://npm.io/package/string-format.md) ^2.0.0
- [terminal-link](https://npm.io/package/terminal-link.md) ^2.1.1

## Recent versions

- 1.1.5 (latest) — 2020-01-30
- 1.1.4 — 2020-01-28
- 1.1.3 — 2020-01-02
- 1.1.2 — 2019-12-27
- 1.1.1 — 2019-12-27
- 1.1.0 — 2019-12-26
- 1.0.8 — 2019-12-26
- 1.0.7 — 2019-12-26
- 1.0.6 — 2019-12-26
- 1.0.5 — 2019-12-26
- 1.0.4 — 2019-12-26
- 1.0.3 — 2019-12-26
- 1.0.2 — 2019-12-25
- 1.0.1 — 2019-12-25
- 1.0.0 — 2019-12-25

## README

# CodeHS Crawler

This is a [NodeJS](https://nodejs.org/) tool using the [Puppeteer](https://developers.google.com/web/tools/puppeteer) headless browser to crawl the [CodeHS](https://codehs.com) code teaching platform for a teacher's students' grades.

## Installation

### Preferred Method
Use the package manager [npm](https://www.npmjs.com/) to install CodeHS Crawler.

```bash
npm install codehs_grades
```
>Note: Add the -g flag to use this tool anywhere; however, out files will have a different path from that of the working path.

### Alternative(Repo) Method
Clone this repository.
```bash
git clone https://github.com/e-zhang09/CodeHS-HWCrawler.git
cd CodeHS-HWCrawler
npm link
```
>Note: outputs will be in the 'out' sub-directory

## Usage

```bash
codehs_grades
```

## Grading Method

### All assignments are out of 10 points.
##### If total time spent on assignment <code>>= 45</code> minutes
Award 10/10 pts for the assignment. 

##### If all exercises are completed (not "Not Submitted" or "Unopened")
Award 10/10 pts for the assignment. 

### If none of the above, loop through each <i>exercise</i> of the assignment <br/>(N is number of exercises in the assignment)
##### If time worked on <i>exercise</i> <code>>= 45 / N</code> minutes
Award the <i>exercise</i> <code>1</code> pt  .

##### If time worked on <i>exercise</i> <code>>= 45 / (N * 3)</code> minutes
Award the <i>exercise</i>  <code>M / (45 / N)</code> pt, where M is the minutes they worked on the exercise.  
(Rounding to the 2nd decimal place)

##### If none of the above
Award the <i>exercise</i> <code>0</code> pt.

>Note: 'Exercises' and 'assignments' are defined below.
## Technical Details
### Definition of Exercise vs Assignment
<b><i>Exercises</i></b> are the problems each student have to solve as an <b><i>assignment</i></b>.

### Calculating time spent on each exercise
Using edit sessions
- A session ends when there was more than 30 minutes between versions or when the last version is reached.  
- The duration of each session is the difference between the first and last version of the session.  
>Note: See [TimeCalculations.md](TimeCalculations.md) for example expected behaviors

### Output file paths
*Will have more options soon*  

**If installed through `npm install codehs_grades`**  
In the `node_modules/codehs_grades/` sub-folder of the install location

**If installed through `npm install codehs_grades -g`**  
On unix systems: `/usr/local/lib/node/codehs_grades/` or `/usr/local/lib/node_modules/codehs_grades/`  
On windows: `%USERPROFILE%\AppData\Roaming\npm\node_modules\codehs_grades\`  
  
**If installed through git clone**  
In the `out` sub-folder of the project installation location

## Troubleshooting
##### Problem names in output are not matching input names
Delete the ./cached directory as problem IDs may have changed

##### Why are there '--' in each of the output fields?
The assignment may have been removed and could not be found, no real solutions as of right now.

##### ERROR: The process with PID \# (child process of PID \#) could not be terminated.
Could be ignored, may cause excessive memory usage?

##### Puppeteer sandbox issues
This tool does not support linux systems yet (mac may not work either)

## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

---
_Source: https://npm.io/package/codehs_grades · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
