Skip to content

Commit

Permalink
Merge branch 'staging' into OCD-4783
Browse files Browse the repository at this point in the history
  • Loading branch information
andlar committed Feb 27, 2025
2 parents 6eda6d3 + 053ccd8 commit 297d1d5
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
10 changes: 5 additions & 5 deletions src/app/components/listing/edit.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const ListingEditComponent = {
}
this.listing.certificationEvents = this.listing.certificationEvents.map((ce) => ({
...ce,
statusDateObject: new Date(ce.eventDate),
statusDateObject: this.DateUtil.getDateFromLocalDate(this.DateUtil.getLocalDate(ce.eventDay)),
}));

if (this.listing.practiceType) {
Expand Down Expand Up @@ -121,17 +121,17 @@ const ListingEditComponent = {
}

matchesPreviousDate(event) {
const orderedStatus = this.$filter('orderBy')(this.listing.certificationEvents, 'statusDateObject');
const orderedStatus = this.$filter('orderBy')(this.listing.certificationEvents, 'eventDay');
const statusLoc = orderedStatus.indexOf(event);
if (statusLoc > 0) {
const test = this.$filter('date')(event.statusDateObject, 'mediumDate', 'UTC') === this.$filter('date')(orderedStatus[statusLoc - 1].statusDateObject, 'mediumDate', 'UTC');
const test = event.eventDay === orderedStatus[statusLoc - 1].eventDay;
return test;
}
return false;
}

matchesPreviousStatus(event) {
const orderedStatus = this.$filter('orderBy')(this.listing.certificationEvents, 'statusDateObject');
const orderedStatus = this.$filter('orderBy')(this.listing.certificationEvents, 'eventDay');
const statusLoc = orderedStatus.indexOf(event);
if (statusLoc > 0) {
return (event.status.name === orderedStatus[statusLoc - 1].status.name);
Expand Down Expand Up @@ -166,7 +166,7 @@ const ListingEditComponent = {
update(doNotUpdateListing) {
this.listing.certificationEvents = this.listing.certificationEvents.map((ce) => ({
...ce,
eventDate: ce.statusDateObject.getTime(),
eventDay: this.DateUtil.getLocalDateFromJsDate(ce.statusDateObject),
}));
if (this.listing.chplProductNumber.length > 12) {
const {
Expand Down
4 changes: 2 additions & 2 deletions src/app/components/listing/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<div class="data-label">Certification Status</div>
<div class="data-label">Effective Date</div>
<div class="data-label">Reason for status change</div>
<div class="manage-list__item--start" ng-repeat-start="item in $ctrl.listing.certificationEvents | orderBy:'-statusDateObject.getTime()' track by $index">
<div class="manage-list__item--start" ng-repeat-start="item in $ctrl.listing.certificationEvents | orderBy:'-eventDay' track by $index">
{{ item.status.name }}
<div class="text-danger" ng-if="!$last && $ctrl.matchesPreviousStatus(item)">Certification Status must differ from previous Status</div>
<div class="text-danger" ng-if="$first && $ctrl.mayCauseSuspension($ctrl.certificationStatusWhenEditing($ctrl.listing))">Setting this product to this status may trigger a ban by ONC</div>
Expand All @@ -53,7 +53,7 @@
<div class="text-danger" ng-if="$first && $ctrl.certificationStatusWhenEditing($ctrl.listing) === 'Withdrawn by Developer'">Be sure this product is not under surveillance or soon to be under surveillance, otherwise use the status "Withdrawn by Developer Under Surveillance/Review"</div>
</div>
<div>
{{ item.eventDate | date : 'mediumDate' : 'GMT' }}
{{ $ctrl.DateUtil.getDisplayDateFormat(item.eventDay) }}
<div class="text-danger" ng-if="$ctrl.matchesPreviousDate(item)">Only one change of status allowed per day</div>
</div>
<div>
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/listing/history/history.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const interpretCertificationStatusChanges = (listing) => listing.certificationEv
.filter((e) => !e.eventTypeId || e.eventTypeId === 1)
.filter((e) => e.eventDay <= jsJoda.LocalDate.now())
.map((e) => {
e.activityDate = parseInt(e.eventDate, 10);
e.activityDate = localDateToTimestamp(e.eventDay);
if (e.eventTypeId && e.eventTypeId === 1) {
e.change = ['Certification Status became "Active"'];
} else if (e.certificationStatusName) {
Expand Down
5 changes: 4 additions & 1 deletion src/app/services/criteria.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,10 @@ const criteriaSortOrder = [
const sortCriteria = (a, b) => {
const aValue = a.number ?? a.certificationNumber;
const bValue = b.number ?? b.certificationNumber;
return criteriaSortOrder.indexOf(aValue) - criteriaSortOrder.indexOf(bValue);
if (criteriaSortOrder.indexOf(aValue) !== criteriaSortOrder.indexOf(bValue)) {
return criteriaSortOrder.indexOf(aValue) - criteriaSortOrder.indexOf(bValue);
}
return a.id - b.id;
};

export {
Expand Down

0 comments on commit 297d1d5

Please sign in to comment.