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 source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"name": "rubric-item-proto",
"version": "0.1.1",
"private": true,
"description": "Exercise rubric item interface for Skilling",
"version": "1.0.0",
"author": "Kieran Mathieson",
"private": false,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"dev": "vue-cli-service build --mode development"
"dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot",
"build": "cross-env NODE_ENV=production webpack --progress --hide-modules"
},
"dependencies": {
"axios": "^0.19.2",
"core-js": "^3.6.4",
"cross-env": "^3.0.0",
"sortablejs": "^1.10.2",
"vue": "^2.6.11",
"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": {
"@vue/cli-plugin-babel": "^4.2.0",
"@vue/cli-plugin-vuex": "^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": [
"> 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.
# 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.
......@@ -47,20 +49,16 @@ Toggle of keep-this-response unclear, when id on or off.
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** Allow ungrade option. Allow regrade option. Delay notification?
F/b allows building for dist. Why not exercise RI editor?
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:
# component:
# libraries/rubric-item-chooser/dist/css/app.3be7a8e9.css: {}
js:
libraries/rubric-item-chooser/dist/js/app.js: {}
libraries/rubric-item-chooser/dist/js/chunk-vendors.js: {}
# libraries/rubric-item-chooser/dist/js/app.js: {}
# libraries/rubric-item-chooser/dist/js/chunk-vendors.js: {}
libraries/rubric-item-chooser/dist/build.js: {}
dependencies:
- core/jquery
- core/jquery.once
......
......@@ -641,8 +641,12 @@ class AssessmentController extends ControllerBase {
if (!isset($enrolledClasses[$studentId])) {
$enrolledClasses[$studentId] = [];
}
// Does the grader have access to the class?
$isGraderForClass = $this->currentUser->isGraderOfClassNid($classId);
if ($isGraderForClass) {
$enrolledClasses[$studentId][] = $classId;
}
}
// Prep data for sending to client.
/** @var \Drupal\user\Entity\User $student */
foreach ($students as $student) {
......
......@@ -773,6 +773,7 @@ class SkillingUser {
* True if the user is an instructor.
*
* @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
* @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
*/
public function isInstructorOfClass($class) {
$classNid = $class->id();
......@@ -797,6 +798,41 @@ class SkillingUser {
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?
*
......@@ -807,6 +843,7 @@ class SkillingUser {
* True if the user is in the class.
*
* @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
* @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
*/
public function isInClass($class) {
$classNid = $class->id();
......
......@@ -149,6 +149,9 @@ class Timeline {
}
else {
// Load the submissions for the exercises.
$submissionIds = [];
$submissions = [];
if (count($exerciseNids) > 0) {
$submissionIds = $this->entityTypeManager->getStorage('node')
->getQuery()
->condition('type', 'submission')
......@@ -163,6 +166,7 @@ class Timeline {
->execute();
$submissions = $this->entityTypeManager->getStorage('node')
->loadMultiple($submissionIds);
}
// Find out the submission status of each exercise.
// Returns array indexed by exercise nid.
$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