Skip to content

Commit

Permalink
Revert "Fix Graduation date question and saving questions validation (#…
Browse files Browse the repository at this point in the history
…842)"

This reverts commit 0db31d8.
  • Loading branch information
dr-bizz authored Sep 8, 2023
1 parent 0db31d8 commit 32dea52
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 19 deletions.
15 changes: 2 additions & 13 deletions app/scripts/controllers/registration.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,16 +367,6 @@ angular
var currentRegistrant = _.find($scope.currentRegistration.registrants, {
id: $scope.currentRegistrant,
});
const invalidBlocks = _.find(currentRegistration.registrants, {
id: currentRegistrant.id,
})
? validateRegistrant.validate(
conference,
_.find(currentRegistration.registrants, {
id: currentRegistrant.id,
}),
)
: [];
var answersToSave = [];

angular.forEach(
Expand All @@ -386,9 +376,8 @@ angular
id: a.id,
});
if (
(angular.isUndefined(savedAnswer) ||
!angular.equals(savedAnswer.value, a.value)) &&
!invalidBlocks.includes(a.blockId)
angular.isUndefined(savedAnswer) ||
!angular.equals(savedAnswer.value, a.value)
) {
if ($scope.registerMode !== 'preview') {
answersToSave.push($http.put('answers/' + a.id, a));
Expand Down
9 changes: 4 additions & 5 deletions app/scripts/directives/datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ angular
},
controller: function ($timeout, $scope) {
$scope.updateTimeStamp = function (timestamp) {
//For the Graduation date question, set the day to 10. The API needs the day but that could change in the future.
//For Graduation date question, set the day to 1. The API needs the day but that could change in the future.
timestamp = $scope.monthYearOnly
? moment(new Date(timestamp)).set('date', 10)
? moment(new Date(timestamp)).set('date', 1)
: timestamp;
$scope.$apply(function () {
let dateSaveFormat = $scope.monthYearOnly
Expand All @@ -30,13 +30,12 @@ angular
},
link: function (scope, element) {
var datePickerElement = angular.element(element).find('.datepicker');
scope.localModel =
var initialDate =
scope.localModel && scope.monthYearOnly
? moment(new Date(scope.localModel)).format('YYYY-MM-DD')
? scope.localModel
: scope.localModel
? moment(new Date(scope.localModel)).format('MM/DD/YYYY hh:mm A')
: null;
let initialDate = scope.localModel || null;
scope.dateOptions = scope.monthYearOnly
? {
viewMode: 'years',
Expand Down
2 changes: 1 addition & 1 deletion test/spec/directives/datepicker.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('Directive: datepicker', function () {
it('Sets the date to the correct format based on the type of date question', function () {
scope.updateTimeStamp(new Date('02/05/1994'));

expect(scope.localModel).toBe('1994-02-10');
expect(scope.localModel).toBe('1994-02-01');

scope.monthYearOnly = false;

Expand Down

0 comments on commit 32dea52

Please sign in to comment.