Commit bc74e7bc authored by mathieso's avatar mathieso

Fix prod build for RI GUI, and test whether grader has access to class

afore referencing it in a student's class list.
parent 6eed502e
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
{ {
"name": "rubric-item-proto", "name": "rubric-item-proto",
"version": "0.1.1", "description": "Exercise rubric item interface for Skilling",
"private": true, "version": "1.0.0",
"author": "Kieran Mathieson",
"private": false,
"scripts": { "scripts": {
"serve": "vue-cli-service serve", "dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot",
"build": "vue-cli-service build", "build": "cross-env NODE_ENV=production webpack --progress --hide-modules"
"dev": "vue-cli-service build --mode development"
}, },
"dependencies": { "dependencies": {
"axios": "^0.19.2", "axios": "^0.19.2",
"core-js": "^3.6.4", "core-js": "^3.6.4",
"cross-env": "^3.0.0",
"sortablejs": "^1.10.2", "sortablejs": "^1.10.2",
"vue": "^2.6.11", "vue": "^2.6.11",
"vue-js-modal": "^1.3.33", "vue-js-modal": "^1.3.33",
"vuex": "^3.1.2" "vuex": "^3.1.2",
"babel-core": "^6.0.0",
"babel-loader": "^6.0.0",
"babel-preset-latest": "^6.0.0",
"css-loader": "^0.25.0",
"file-loader": "^0.9.0",
"moment": "^2.18.1",
"node-sass": "^4.5.3",
"sass-loader": "^6.0.5",
"style-loader": "^0.18.1",
"vue-loader": "^11.1.4"
}, },
"devDependencies": { "devDependencies": {
"@vue/cli-plugin-babel": "^4.2.0", "@vue/cli-plugin-babel": "^4.2.0",
"@vue/cli-plugin-vuex": "^4.2.0", "@vue/cli-plugin-vuex": "^4.2.0",
"@vue/cli-service": "^4.2.0", "@vue/cli-service": "^4.2.0",
"vue-template-compiler": "^2.6.11" "vue-loader": "^11.1.4",
"vue-template-compiler": "^2.6.11",
"webpack": "^2.2.0",
"webpack-dev-server": "^2.2.0",
"wepack": "0.0.1"
}, },
"browserslist": [ "browserslist": [
"> 1%", "> 1%",
......
var path = require('path')
var webpack = require('webpack')
module.exports = {
entry: './src/main.js',
output: {
path: path.resolve(__dirname, './dist'),
publicPath: './dist/',
filename: 'build.js'
},
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
loaders: {
scss: 'vue-style-loader!css-loader',
}
// other vue-loader options go here
}
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.(png|jpg|gif|svg)$/,
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]'
}
},
{ test: /\.css$/, loaders: 'style-loader!css-loader' }
]
},
resolve: {
alias: {
'vue$': 'vue/dist/vue.esm.js'
}
},
devServer: {
historyApiFallback: true,
noInfo: true
},
performance: {
hints: false
},
devtool: '#eval-source-map'
}
if (process.env.NODE_ENV === 'production') {
module.exports.devtool = '#source-map'
// http://vue-loader.vuejs.org/en/workflow/production.html
module.exports.plugins = (module.exports.plugins || []).concat([
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
}),
// new webpack.optimize.minimize({
// sourceMap: true,
// compress: {
// warnings: false
// }
// }),
// new webpack.optimize.UglifyJsPlugin({
// sourceMap: true,
// compress: {
// warnings: false
// }
// }),
new webpack.LoaderOptionsPlugin({
minimize: true
})
])
}
...@@ -39,7 +39,9 @@ Check progress score computation, and reports for instructor. ...@@ -39,7 +39,9 @@ Check progress score computation, and reports for instructor.
# Grading interface # Grading interface
Submissions view for graders, own submissions only. ? During fetching data for the interface, only include classes in student data
that the grader has access to.
Toggle of keep-this-response unclear, when id on or off. Toggle of keep-this-response unclear, when id on or off.
...@@ -47,20 +49,16 @@ Toggle of keep-this-response unclear, when id on or off. ...@@ -47,20 +49,16 @@ Toggle of keep-this-response unclear, when id on or off.
Refresh after a while crashes. Refresh after a while crashes.
**2.0** Show prior submissions.
**2.0** Maintain order of RIs in text message ? **2.0** Maintain order of RIs in text message
**2.0** Check if excludes RIs that are not shown for a given exercise. **2.0** Check if excludes RIs that are not shown for a given exercise.
**2.0** Allow ungrade option. Allow regrade option. Delay notification?
F/b allows building for dist. Why not exercise RI editor?
Save and edit fior exercises Save and edit fior exercises
Skip submissons for exercises/students that don't exist anymore. Or student blocked. ? Skip submissions for exercises/students that don't exist anymore. Or student blocked.
......
...@@ -264,8 +264,9 @@ rubric-item-chooser: ...@@ -264,8 +264,9 @@ rubric-item-chooser:
# component: # component:
# libraries/rubric-item-chooser/dist/css/app.3be7a8e9.css: {} # libraries/rubric-item-chooser/dist/css/app.3be7a8e9.css: {}
js: js:
libraries/rubric-item-chooser/dist/js/app.js: {} # libraries/rubric-item-chooser/dist/js/app.js: {}
libraries/rubric-item-chooser/dist/js/chunk-vendors.js: {} # libraries/rubric-item-chooser/dist/js/chunk-vendors.js: {}
libraries/rubric-item-chooser/dist/build.js: {}
dependencies: dependencies:
- core/jquery - core/jquery
- core/jquery.once - core/jquery.once
......
...@@ -641,7 +641,11 @@ class AssessmentController extends ControllerBase { ...@@ -641,7 +641,11 @@ class AssessmentController extends ControllerBase {
if (!isset($enrolledClasses[$studentId])) { if (!isset($enrolledClasses[$studentId])) {
$enrolledClasses[$studentId] = []; $enrolledClasses[$studentId] = [];
} }
$enrolledClasses[$studentId][] = $classId; // Does the grader have access to the class?
$isGraderForClass = $this->currentUser->isGraderOfClassNid($classId);
if ($isGraderForClass) {
$enrolledClasses[$studentId][] = $classId;
}
} }
// Prep data for sending to client. // Prep data for sending to client.
/** @var \Drupal\user\Entity\User $student */ /** @var \Drupal\user\Entity\User $student */
......
...@@ -773,6 +773,7 @@ class SkillingUser { ...@@ -773,6 +773,7 @@ class SkillingUser {
* True if the user is an instructor. * True if the user is an instructor.
* *
* @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
* @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
*/ */
public function isInstructorOfClass($class) { public function isInstructorOfClass($class) {
$classNid = $class->id(); $classNid = $class->id();
...@@ -797,6 +798,41 @@ class SkillingUser { ...@@ -797,6 +798,41 @@ class SkillingUser {
return $isInstructor; return $isInstructor;
} }
/**
* Is the user a grader of the given class?
*
* @param \Drupal\node\NodeInterface $class
* The class.
*
* @return bool
* True if the user is a grader.
*
* @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
* @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
*/
public function isGraderOfClass($class) {
$classNid = $class->id();
$result = $this->isInstructorOfClassNid($classNid);
return $result;
}
/**
* Is the user a grader of the class with the given nid?
*
* @param int $classNid The class's node id.
*
* @return bool True if the user is a grader.
* @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
* @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
*/
public function isGraderOfClassNid($classNid) {
$classRoles = $this->getClassSpecificRolesForClassNids([$classNid]);
$isGrader = in_array(
SkillingConstants::CLASS_ROLE_GRADER, $classRoles
);
return $isGrader;
}
/** /**
* Is the user in the given class? * Is the user in the given class?
* *
...@@ -807,6 +843,7 @@ class SkillingUser { ...@@ -807,6 +843,7 @@ class SkillingUser {
* True if the user is in the class. * True if the user is in the class.
* *
* @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
* @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
*/ */
public function isInClass($class) { public function isInClass($class) {
$classNid = $class->id(); $classNid = $class->id();
......
...@@ -149,20 +149,24 @@ class Timeline { ...@@ -149,20 +149,24 @@ class Timeline {
} }
else { else {
// Load the submissions for the exercises. // Load the submissions for the exercises.
$submissionIds = $this->entityTypeManager->getStorage('node') $submissionIds = [];
->getQuery() $submissions = [];
->condition('type', 'submission') if (count($exerciseNids) > 0) {
// For the current user. $submissionIds = $this->entityTypeManager->getStorage('node')
->condition('field_user', $this->currentUser->id()) ->getQuery()
// Published submissions. ->condition('type', 'submission')
->condition('status', 1) // For the current user.
// One of the exercises in question. ->condition('field_user', $this->currentUser->id())
->condition('field_exercise.target_id', $exerciseNids, 'IN') // Published submissions.
// Exercise is published. Extra check. ->condition('status', 1)
->condition('field_exercise.entity.status', 1) // One of the exercises in question.
->execute(); ->condition('field_exercise.target_id', $exerciseNids, 'IN')
$submissions = $this->entityTypeManager->getStorage('node') // Exercise is published. Extra check.
->loadMultiple($submissionIds); ->condition('field_exercise.entity.status', 1)
->execute();
$submissions = $this->entityTypeManager->getStorage('node')
->loadMultiple($submissionIds);
}
// Find out the submission status of each exercise. // Find out the submission status of each exercise.
// Returns array indexed by exercise nid. // Returns array indexed by exercise nid.
$exercisesSubmissionSummary = $this->submissionsService $exercisesSubmissionSummary = $this->submissionsService
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment