<commit_before>'use strict';

import * as _ from 'lodash'

import hasDepartment from '../app/helpers/hasDepartment'
import {partialTitle} from '../app/helpers/partialTitle'
import {checkCoursesFor} from '../app/helpers/getCourses'

import {isRequiredCourse} from './commonMajorUtilities'

const csDeptRequiredCourses = [
	{deptnum: 'CSCI 121'}, {deptnum: 'CSCI 125'}, {deptnum: 'CSCI 241'}, {deptnum: 'CSCI 251'},
	{deptnum: 'CSCI 252'}, {deptnum: 'CSCI 231'}, {deptnum: 'CSCI 253'}, {deptnum: 'CSCI 263'},
	{deptnum: 'CSCI 276'}, {deptnum: 'CSCI 333'}, {deptnum: 'CSCI 273'}, {deptnum: 'CSCI 284'},
	{deptnum: 'CSCI 390'},

	{deptnum: 'CSCI 300', name: 'Parallel'},

	{deptnum: 'MATH 232'}, {deptnum: 'MATH 252'},
]

let isRequiredCompSciCourse = _.curry(isRequiredCourse(csDeptRequiredCourses))

function foundationCourses(courses) {
	/* Foundation courses:
		- one of Computer Science 121 or 125;
		- Computer Science 241, 251, and 252;
		- one of Computer Science 231 or Math 232 or Math 252.
	*/

	var cs1 = _.any([
		checkCoursesFor(courses, {dept:'CSCI', num:121}),
		checkCoursesFor(courses, {dept:'CSCI', num:125}),
	])

	var design = _.all([
		checkCoursesFor(courses, {dept:'CSCI', num:241}),
		checkCoursesFor(courses, {dept:'CSCI', num:251}),
		checkCoursesFor(courses, {dept:'CSCI', num:252}),
	])

	var mfc = _.any([
		checkCoursesFor(courses, {dept:'CSCI', num:231}),
		checkCoursesFor(courses, {dept:'MATH', num:232}),
		checkCoursesFor(courses, {dept:'MATH', num:252}),
	])

	let requirements = [
		{
			title: 'CS1',
			result: cs1,
		},
		{
			title: 'Design',
			result: design,
		},
		{
			title: 'MFC',
			result: mfc,
		},
	]

	return {
		title: 'Foundation',
		description: 'one of Computer Science 121 or 125; Computer Science 241, 251, and 252; one of Computer Science 231 or Math 232 or Math 252.',
		result: _.all(requirements),
		type: 'array/boolean',
		details: requirements,
	}
}

function coreCourses(courses) {
	/* Core courses:
		- Computer Science 253;
		- Computer Science 263;
		- either of Computer Science 276 or 333;
		- and either Computer Science 273, 284, or 300 with parallel and distributed computing.
	*/

	var algorithms = checkCoursesFor(courses, {dept:'CSCI', num:253})

	var ethics = checkCoursesFor(courses, {dept:'CSCI', num:263})

	var theory = _.any([
		checkCoursesFor(courses, {dept:'CSCI', num:276}),
		checkCoursesFor(courses, {dept:'CSCI', num:333})
	])

	var parallelDistributedComputing = _.chain(courses)
		.filter({dept: 'CSCI', num: 300})
		.filter(partialTitle('Parallel'))
		.size().value() >= 1

	var options = _.any([
		checkCoursesFor(courses, {dept:'CSCI', num:273}),
		checkCoursesFor(courses, {dept:'CSCI', num:284}),
		parallelDistributedComputing
	])

	let requirements = [
		{
			title: 'Algorithms',
			result: algorithms,
		},
		{
			title: 'Ethics',
			result: ethics,
		},
		{
			title: 'Theory',
			result: theory,
		},
		{
			title: 'Options',
			result: options
		},
	]

	return {
		title: 'Core',
		type: 'array/boolean',
		description: 'Computer Science 253; Computer Science 263; either Computer Science 276 or 333; and either Computer Science 273, 284, or 300 with parallel and distributed computing.',
		result: _.all(requirements),
		details: requirements,
	}
}<commit_msg>Check "_.all" (in CSCI.major) against the results attribute<commit_after>'use strict';

import * as _ from 'lodash'

import hasDepartment from '../app/helpers/hasDepartment'
import {partialTitle} from '../app/helpers/partialTitle'
import {checkCoursesFor} from '../app/helpers/getCourses'

import {isRequiredCourse} from './commonMajorUtilities'

const csDeptRequiredCourses = [
	{deptnum: 'CSCI 121'}, {deptnum: 'CSCI 125'}, {deptnum: 'CSCI 241'}, {deptnum: 'CSCI 251'},
	{deptnum: 'CSCI 252'}, {deptnum: 'CSCI 231'}, {deptnum: 'CSCI 253'}, {deptnum: 'CSCI 263'},
	{deptnum: 'CSCI 276'}, {deptnum: 'CSCI 333'}, {deptnum: 'CSCI 273'}, {deptnum: 'CSCI 284'},
	{deptnum: 'CSCI 390'},

	{deptnum: 'CSCI 300', name: 'Parallel'},

	{deptnum: 'MATH 232'}, {deptnum: 'MATH 252'},
]

let isRequiredCompSciCourse = _.curry(isRequiredCourse(csDeptRequiredCourses))

function foundationCourses(courses) {
	/* Foundation courses:
		- one of Computer Science 121 or 125;
		- Computer Science 241, 251, and 252;
		- one of Computer Science 231 or Math 232 or Math 252.
	*/

	var cs1 = _.any([
		checkCoursesFor(courses, {dept:'CSCI', num:121}),
		checkCoursesFor(courses, {dept:'CSCI', num:125}),
	])

	var design = _.all([
		checkCoursesFor(courses, {dept:'CSCI', num:241}),
		checkCoursesFor(courses, {dept:'CSCI', num:251}),
		checkCoursesFor(courses, {dept:'CSCI', num:252}),
	])

	var mfc = _.any([
		checkCoursesFor(courses, {dept:'CSCI', num:231}),
		checkCoursesFor(courses, {dept:'MATH', num:232}),
		checkCoursesFor(courses, {dept:'MATH', num:252}),
	])

	let requirements = [
		{
			title: 'CS1',
			result: cs1,
		},
		{
			title: 'Design',
			result: design,
		},
		{
			title: 'MFC',
			result: mfc,
		},
	]

	return {
		title: 'Foundation',
		description: 'one of Computer Science 121 or 125; Computer Science 241, 251, and 252; one of Computer Science 231 or Math 232 or Math 252.',
		result: _.all(requirements, 'result'),
		type: 'array/boolean',
		details: requirements,
	}
}

function coreCourses(courses) {
	/* Core courses:
		- Computer Science 253;
		- Computer Science 263;
		- either of Computer Science 276 or 333;
		- and either Computer Science 273, 284, or 300 with parallel and distributed computing.
	*/

	var algorithms = checkCoursesFor(courses, {dept:'CSCI', num:253})

	var ethics = checkCoursesFor(courses, {dept:'CSCI', num:263})

	var theory = _.any([
		checkCoursesFor(courses, {dept:'CSCI', num:276}),
		checkCoursesFor(courses, {dept:'CSCI', num:333})
	])

	var parallelDistributedComputing = _.chain(courses)
		.filter({dept: 'CSCI', num: 300})
		.filter(partialTitle('Parallel'))
		.size().value() >= 1

	var options = _.any([
		checkCoursesFor(courses, {dept:'CSCI', num:273}),
		checkCoursesFor(courses, {dept:'CSCI', num:284}),
		parallelDistributedComputing
	])

	let requirements = [
		{
			title: 'Algorithms',
			result: algorithms,
		},
		{
			title: 'Ethics',
			result: ethics,
		},
		{
			title: 'Theory',
			result: theory,
		},
		{
			title: 'Options',
			result: options
		},
	]

	return {
		title: 'Core',
		type: 'array/boolean',
		description: 'Computer Science 253; Computer Science 263; either Computer Science 276 or 333; and either Computer Science 273, 284, or 300 with parallel and distributed computing.',
		result: _.all(requirements, 'result'),
		details: requirements,
	}
}
{'fraction_non_alphanumeric': 0.1595873786407767, 'fraction_numerical': 0.056735436893203886, 'mean_word_length': 4.430807248764415, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6582090', 'n_tokens_mistral': 2901, 'n_tokens_neox': 2371, 'n_words': 625}