diff --git a/CV/MAC.json b/CV/MAC.json
index 830c249..356e91c 100644
--- a/CV/MAC.json
+++ b/CV/MAC.json
@@ -281,7 +281,7 @@
"name": "Corunet",
"image": {
"alt": "corunet.svg",
- "link": "https://media-asgard.s3.eu-west-1.amazonaws.com/22/04/22/2e8009b8-f641-4f6e-abdf-3d119ea6ced5_corunet.svg"
+ "link": "https://media-asgard.s3.eu-west-1.amazonaws.com/22/04/22/22bca95a-64d7-45d2-b99a-15bda6276fe6_corunet.svg"
}
},
"roles": [
diff --git a/CV/snapshot.html b/CV/snapshot.html
index 6d46052..a88349a 100644
--- a/CV/snapshot.html
+++ b/CV/snapshot.html
@@ -576,22 +576,6 @@
-
-
-
-
-
-
-
-
![corunet.svg](https://media-asgard.s3.eu-west-1.amazonaws.com/22/04/22/2e8009b8-f641-4f6e-abdf-3d119ea6ced5_corunet.svg)
-
- Corunet
-
-
-
-
-
-
09/2017 - 01/2018
diff --git a/lib/utils.ts b/lib/utils.ts
index 75350a9..23f14f1 100644
--- a/lib/utils.ts
+++ b/lib/utils.ts
@@ -1,3 +1,4 @@
+import { isEqual, isNil } from "lodash";
import { Highlight, Job, Project, Study } from "./mac";
export function generatorFrom
(
@@ -25,7 +26,11 @@ export function sortByDates(
return elements;
}
- if (isArrayOfType(elements, (e) => "roles" in e)) {
+ if (isArrayOfType(elements, (e) => "organization" in e && "roles" in e)) {
+ return sortJobs(elements);
+ }
+
+ if (isArrayOfType(elements, (e) => "roles" in e)) {
return sortByDatesInternal(
elements,
(e) => e.roles[0].startDate,
@@ -54,6 +59,48 @@ export function sortByDates(
});
}
+function sortJobs(jobs: Job[]): Job[] {
+ const flattenedRoles = jobs.flatMap((job) => {
+ return job.roles.map((role) => {
+ return {
+ role: role,
+ organization: job.organization,
+ type: job.type,
+ };
+ });
+ });
+
+ const sortedRoles = sortByDatesInternal(
+ flattenedRoles,
+ (e) => e.role.startDate,
+ (e) => e.role.finishDate
+ );
+
+ const finalJobs: Job[] = [];
+
+ for (const role of sortedRoles) {
+ const lastJob = finalJobs[finalJobs.length - 1];
+
+ if (
+ isNil(lastJob) ||
+ !isEqual(
+ { organization: lastJob.organization, type: lastJob.type },
+ { organization: role.organization, type: role.type }
+ )
+ ) {
+ finalJobs.push({
+ organization: role.organization,
+ type: role.type,
+ roles: [role.role],
+ });
+ } else {
+ lastJob.roles.push(role.role);
+ }
+ }
+
+ return finalJobs;
+}
+
function isArrayOfType(
elements: object[],
typeGuard: (element: object) => boolean
diff --git a/package-lock.json b/package-lock.json
index 6ad63a3..ac837e9 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -12,6 +12,7 @@
"commander": "10.0.0",
"escape-html": "1.0.3",
"jsonschema": "1.4.1",
+ "lodash": "4.17.21",
"marked": "4.2.12"
},
"bin": {
@@ -1824,8 +1825,7 @@
"node_modules/lodash": {
"version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
- "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
- "dev": true
+ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
},
"node_modules/lodash.merge": {
"version": "4.6.2",
@@ -4163,8 +4163,7 @@
"lodash": {
"version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
- "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
- "dev": true
+ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
},
"lodash.merge": {
"version": "4.6.2",
diff --git a/package.json b/package.json
index 0c9771b..80d5f62 100644
--- a/package.json
+++ b/package.json
@@ -33,6 +33,7 @@
"commander": "10.0.0",
"escape-html": "1.0.3",
"jsonschema": "1.4.1",
+ "lodash": "4.17.21",
"marked": "4.2.12"
},
"repository": {