problem with default image for newly created student solved. issue #611 completed

parent 4d1303b9
...@@ -245,7 +245,7 @@ module.exports = { ...@@ -245,7 +245,7 @@ module.exports = {
beforeCreate: function (attrs, next) { beforeCreate: function (attrs, next) {
attrs.attributes = Student.getValidAttributes(attrs.attributes); attrs.attributes = Student.getValidAttributes(attrs.attributes);
attrs.password = bcrypt.hashSync(attrs.password, bcrypt.genSaltSync()); attrs.password = bcrypt.hashSync(attrs.password, bcrypt.genSaltSync());
attrs.pic = "defaultAvatar.jpg"; attrs.pic = sails.config.pictogram.urls.getStudentAvatarUrl();
next(); next();
}, },
......
...@@ -24,7 +24,6 @@ dashboardControllers.controller('StudentsCtrl', function StudentsCtrl( ...@@ -24,7 +24,6 @@ dashboardControllers.controller('StudentsCtrl', function StudentsCtrl(
gender: 'M', gender: 'M',
lang: 'es-es', lang: 'es-es',
notes: '', notes: '',
pic: 'defaultAvatar.jpg',
office: $scope.user.office || { name: '' } office: $scope.user.office || { name: '' }
}; };
...@@ -39,15 +38,6 @@ dashboardControllers.controller('StudentsCtrl', function StudentsCtrl( ...@@ -39,15 +38,6 @@ dashboardControllers.controller('StudentsCtrl', function StudentsCtrl(
console.log("currentStudents: " + $scope.user.office.currentStudents); console.log("currentStudents: " + $scope.user.office.currentStudents);
console.log("maxStudents: " + $scope.user.office.maxStudents); console.log("maxStudents: " + $scope.user.office.maxStudents);
// Compute number of licenses left
if ($scope.user.office.currentStudents >= $scope.user.office.maxStudents) {
$scope.num_licenses_left = 0;
} else {
$scope.num_licenses_left =
$scope.user.office.maxStudents -
$scope.user.office.currentStudents;
}
} else { } else {
$scope.user.office = { name: '' }; $scope.user.office = { name: '' };
} }
...@@ -114,6 +104,7 @@ dashboardControllers.controller('StudentsCtrl', function StudentsCtrl( ...@@ -114,6 +104,7 @@ dashboardControllers.controller('StudentsCtrl', function StudentsCtrl(
data.supervision = 0; // by default, only related to office administrator data.supervision = 0; // by default, only related to office administrator
data.current_method = $translate.instant('no_method'); data.current_method = $translate.instant('no_method');
data.current_instruction = $translate.instant('no_instruction'); data.current_instruction = $translate.instant('no_instruction');
data.licenseIsValid = new Date(data.license.expiration_ts) - new Date() > 0 ? true : false;
$scope.students.push(data); $scope.students.push(data);
$scope.resetForm(); $scope.resetForm();
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
</div> </div>
</td> </td>
<td> <td>
<span ng-show="!student.licenseIsValid" class="license-warning text-danger glyphicon glyphicon-warning-sign" aria-hidden="true" popover="{{ 'license_invalid' | translate}}" popover-trigger="mouseenter"></span> <span ng-show="!student.licenseIsValid" class="license-warning text-danger glyphicon glyphicon-exclamation-sign" aria-hidden="true" popover="{{ 'license_invalid' | translate}}" popover-trigger="mouseenter"></span>
</td> </td>
<td> <td>
<h4>{{student.surname}}, {{student.name}}</h4> <h4>{{student.surname}}, {{student.name}}</h4>
......
...@@ -775,7 +775,7 @@ img.profile{ ...@@ -775,7 +775,7 @@ img.profile{
} }
.delete_stu, .license-warning{ .delete_stu, .license-warning{
font-size: 24px; font-size: 18px;
margin-top: 10px; margin-top: 10px;
} }
......
...@@ -33,7 +33,7 @@ module.exports.pictogram = { ...@@ -33,7 +33,7 @@ module.exports.pictogram = {
*/ */
getStudentAvatarUrl: function (filename) { getStudentAvatarUrl: function (filename) {
if (!filename) if (!filename)
filename = sails.config.pictogram.paths.deafultAvatarFileName; filename = sails.config.pictogram.paths.defaultAvatarFileName;
return `/upload/studentAvatar/${filename}`; return `/upload/studentAvatar/${filename}`;
}, },
......
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 sign in to comment