Skip to content

Commit

Permalink
Develop (#102)
Browse files Browse the repository at this point in the history
* fix closing cause in list SU

* Update package.json
  • Loading branch information
SimonDmz authored Feb 13, 2024
1 parent a20b623 commit 7b040de
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sonor",
"version": "0.5.32",
"version": "0.5.33",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
Expand Down
3 changes: 2 additions & 1 deletion src/components/ListSU/SurveyUnitLine.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function SurveyUnitLine({
state,
remindersByOrder = [],
contactOutcome,
closingCause,
} = lineData;

const getReminderDescription = (reminder) => {
Expand Down Expand Up @@ -115,7 +116,7 @@ function SurveyUnitLine({
</td>
</>
)}
<td className="ColState">{state ? D[state] : ""}</td>
<td className="ColState">{closingCause ? D[closingCause] : ""}</td>
</tr>
);
}
Expand Down
18 changes: 16 additions & 2 deletions src/utils/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,7 @@ class Utils {
'survey',
'site',
'date',
'finalizationDate',
'state',
'finalizationDate',
];
if (labelsSimpleSort.includes(sortOn)) {
return (a, b) => {
Expand All @@ -200,6 +199,21 @@ class Utils {
return mainSort ? mainSortFunc(a, b) : 0;
};
}
if (sortOn === 'state') {
return (a, b) => {
const aState = a.closingCause ? D[a.closingCause] : undefined;
const bState = b.closingCause ? D[b.closingCause] : undefined;

if(!aState || !bState){
return aState ? -1 * mult : 1 * mult;
}
if (aState !== bState) {
return (aState < bState ? -1 : 1) * mult;
}
return mainSort ? mainSortFunc(a, b) : 0;
};
}

if (sortOn === 'CPinterviewer') {
return (a, b) => {
const aString = a.interviewerLastName + a.interviewerFirstName;
Expand Down

0 comments on commit 7b040de

Please sign in to comment.