From bf4e036b7f147f350d4e3ec8550f39275662c4f8 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Fri, 10 Feb 2023 11:53:08 +0100 Subject: [PATCH 1/5] FEATURE [eval][duration] property added to an to save the time spent working on evaluation --- .../AccompanyingPeriodWorkEvaluation.php | 17 ++++++++++++ .../migrations/Version20230210104424.php | 26 +++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 src/Bundle/ChillPersonBundle/migrations/Version20230210104424.php diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php index 078ef0c3c..39266b57e 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php @@ -160,6 +160,11 @@ class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackU */ private ?DateInterval $warningInterval = null; + /** + * @ORM\Column(type="time", nullable=true) + */ + private ?DateTimeInterface $timeSpent = null; + public function __construct() { $this->documents = new ArrayCollection(); @@ -265,6 +270,11 @@ class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackU return $this->warningInterval; } + public function getTimeSpent(): ?DateTimeInterface + { + return $this->timeSpent; + } + public function removeDocument(AccompanyingPeriodWorkEvaluationDocument $document): self { $this->documents->removeElement($document); @@ -322,6 +332,13 @@ class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackU return $this; } + public function setTimeSpent(?DateTimeInterface $timeSpent): self + { + $this->timeSpent = $timeSpent; + + return $this; + } + public function setEvaluation(?Evaluation $evaluation): AccompanyingPeriodWorkEvaluation { if ( diff --git a/src/Bundle/ChillPersonBundle/migrations/Version20230210104424.php b/src/Bundle/ChillPersonBundle/migrations/Version20230210104424.php new file mode 100644 index 000000000..ea18e9adf --- /dev/null +++ b/src/Bundle/ChillPersonBundle/migrations/Version20230210104424.php @@ -0,0 +1,26 @@ +addSql('ALTER TABLE chill_person_accompanying_period_work_evaluation ADD timeSpent TIME(0) WITHOUT TIME ZONE DEFAULT NULL'); + } + + public function down(Schema $schema): void + { + $this->addSql('ALTER TABLE chill_person_accompanying_period_work_evaluation DROP timeSpent'); + } +} From 8a6b2354bd413bc0c3472edff76cb3939edee181 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Fri, 10 Feb 2023 12:58:31 +0100 Subject: [PATCH 2/5] FEATURE [vue][form] incorporating the timeSpent field in the vue form --- .../components/FormEvaluation.vue | 34 +++++++++++++++++++ .../vuejs/AccompanyingCourseWorkEdit/store.js | 4 +++ 2 files changed, 38 insertions(+) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/FormEvaluation.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/FormEvaluation.vue index 4bf9e1a8a..c8101b2ba 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/FormEvaluation.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/FormEvaluation.vue @@ -49,6 +49,19 @@ +
+ +
+ +
+
+
@@ -190,6 +203,7 @@ const i18n = { evaluation_choose_a_template: "Choisir un modèle", evaluation_add_a_document: "Ajouter un document", evaluation_add: "Ajouter une évaluation", + evaluation_time_spent: "Temps de rédaction", Documents: "Documents", document_add: "Générer ou téléverser un document", document_upload: "Téléverser un document", @@ -223,6 +237,22 @@ export default { maxPostSize: 15000000, required: false, }, + timeSpentChoices: [ + { text: '1 minute', value: 60 }, { text: '2 minutes', value: 120 }, + { text: '3 minutes', value: 180 }, { text: '4 minutes', value: 240 }, + { text: '5 minutes', value: 300 }, { text: '10 minutes', value: 600 }, + { text: '15 minutes', value: 900 },{ text: '20 minutes', value: 1200 }, + { text: '25 minutes', value: 1500 }, { text: '30 minutes', value: 1800 }, + { text: '45 minutes', value: 2700 },{ text: '1 hour', value: 3600 }, + { text: '1 hour 15 minutes', value: 4500 }, { text: '1 hour 30 minutes', value: 5400 }, + { text: '1 hour 45 minutes', value: 6300 }, { text: '2 hours', value: 7200 }, + { text: '2 hours 30 minutes', value: 9000 }, { text: '3 hours', value: 10800 }, + { text: '3 hours 30 minutes', value: 12600 },{ text: '4 hours', value: 14400 }, + { text: '4 hours 30 minutes', value: 16200 },{ text: '5 hours', value: 18000 }, + { text: '5 hours 30 minutes', value: 19800 },{ text: '6 hours', value: 21600 }, + { text: '6 hours 30 minutes', value: 23400 },{ text: '7 hours', value: 25200 }, + { text: '7 hours 30 minutes', value: 27000 },{ text: '8 hours', value: 28800 }, + ] } }, computed: { @@ -264,6 +294,10 @@ export default { get() { return this.evaluation.warningInterval; }, set(v) { this.$store.commit('setEvaluationWarningInterval', { key: this.evaluation.key, days: v }); } }, + timeSpent: { + get() { return this.timeSpentChoices }, + set(v) { this.$store.commit('setEvaluationTimeSpent', { key: this.evaluation.key, time: v}) } + }, comment: { get() { return this.evaluation.comment; }, set(v) { this.$store.commit('setEvaluationComment', { key: this.evaluation.key, comment: v }); } diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js index acbe51981..ee011ae28 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js @@ -286,6 +286,10 @@ const store = createStore({ state.evaluationsPicked.find(e => e.key === key) .warningInterval = days; }, + setEvaluationTimeSpent(state, {key, time}) { + state.evaluationsPicked.find(e => e.key === key) + .timeSpent = time; + }, setEvaluationComment(state, {key, comment}) { state.evaluationsPicked.find(e => e.key === key) .comment = comment; From 4a62c2e167063c6f00b2a463626cace282333a51 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 15 Feb 2023 11:17:59 +0100 Subject: [PATCH 3/5] FEATURE [evaluation][serialization] add new time spent property to serialization --- .../AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php index 39266b57e..9cb26b4c3 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php @@ -162,6 +162,9 @@ class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackU /** * @ORM\Column(type="time", nullable=true) + * @Serializer\Groups({"read", "docgen:read"}) + * @Serializer\Groups({"write"}) + * @Serializer\Groups({"accompanying_period_work_evaluation:create"}) */ private ?DateTimeInterface $timeSpent = null; From 80a88fc00c533bc9282f3b1294200875a86a7acb Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 15 Feb 2023 11:28:05 +0100 Subject: [PATCH 4/5] FEATURE [timespent][type] change type of time spent to integer --- .../AccompanyingPeriodWorkEvaluation.php | 8 ++++---- .../migrations/Version20230210104424.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php index 9cb26b4c3..8780f7d17 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php @@ -161,12 +161,12 @@ class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackU private ?DateInterval $warningInterval = null; /** - * @ORM\Column(type="time", nullable=true) + * @ORM\Column(type="integer", nullable=true) * @Serializer\Groups({"read", "docgen:read"}) * @Serializer\Groups({"write"}) * @Serializer\Groups({"accompanying_period_work_evaluation:create"}) */ - private ?DateTimeInterface $timeSpent = null; + private ?int $timeSpent = null; public function __construct() { @@ -273,7 +273,7 @@ class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackU return $this->warningInterval; } - public function getTimeSpent(): ?DateTimeInterface + public function getTimeSpent(): ?int { return $this->timeSpent; } @@ -335,7 +335,7 @@ class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackU return $this; } - public function setTimeSpent(?DateTimeInterface $timeSpent): self + public function setTimeSpent(?int $timeSpent): self { $this->timeSpent = $timeSpent; diff --git a/src/Bundle/ChillPersonBundle/migrations/Version20230210104424.php b/src/Bundle/ChillPersonBundle/migrations/Version20230210104424.php index ea18e9adf..ec802a993 100644 --- a/src/Bundle/ChillPersonBundle/migrations/Version20230210104424.php +++ b/src/Bundle/ChillPersonBundle/migrations/Version20230210104424.php @@ -16,7 +16,7 @@ final class Version20230210104424 extends AbstractMigration public function up(Schema $schema): void { - $this->addSql('ALTER TABLE chill_person_accompanying_period_work_evaluation ADD timeSpent TIME(0) WITHOUT TIME ZONE DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_person_accompanying_period_work_evaluation ADD timeSpent INT DEFAULT NULL'); } public function down(Schema $schema): void From a5f4eabc341e149a1fb8239e8e5cf208dc59c28d Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 15 Feb 2023 11:50:05 +0100 Subject: [PATCH 5/5] FEATURE [store][component] final adjustments to methods to post time spent --- .../components/FormEvaluation.vue | 6 ++++-- .../public/vuejs/AccompanyingCourseWorkEdit/store.js | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/FormEvaluation.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/FormEvaluation.vue index c8101b2ba..13f02e4d6 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/FormEvaluation.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/FormEvaluation.vue @@ -55,7 +55,8 @@
@@ -204,6 +205,7 @@ const i18n = { evaluation_add_a_document: "Ajouter un document", evaluation_add: "Ajouter une évaluation", evaluation_time_spent: "Temps de rédaction", + select_time_spent: "Indiquez le temps de rédaction", Documents: "Documents", document_add: "Générer ou téléverser un document", document_upload: "Téléverser un document", @@ -295,7 +297,7 @@ export default { set(v) { this.$store.commit('setEvaluationWarningInterval', { key: this.evaluation.key, days: v }); } }, timeSpent: { - get() { return this.timeSpentChoices }, + get() { return this.evaluation.timeSpent }, set(v) { this.$store.commit('setEvaluationTimeSpent', { key: this.evaluation.key, time: v}) } }, comment: { diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js index ee011ae28..5c610fa50 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js @@ -116,6 +116,7 @@ const store = createStore({ endDate: e.endDate === null || e.endDate === '' ? null : { datetime: datetimeToISO(ISOToDate(e.endDate)) }, maxDate: e.maxDate === null || e.maxDate === '' ? null : { datetime: datetimeToISO(ISOToDate(e.maxDate)) }, warningInterval: intervalDaysToISO(e.warningInterval), + timeSpent: e.timeSpent, comment: e.comment, documents: e.documents }; @@ -138,6 +139,7 @@ const store = createStore({ endDate: e.endDate !== null ? dateToISO(new Date(e.endDate.datetime)) : null, maxDate: e.maxDate !== null ? dateToISO(new Date(e.maxDate.datetime)) : null, warningInterval: e.warningInterval !== null ? intervalISOToDays(e.warningInterval) : null, + timeSpent: e.timeSpent !== null ? e.timeSpent : null, documents: e.documents.map((d, docIndex) => { return Object.assign(d, { key: docIndex @@ -258,6 +260,7 @@ const store = createStore({ endDate: null, maxDate: null, warningInterval: null, + timeSpent: null, comment: "", editEvaluation: true, workflows_availables: state.work.workflows_availables_evaluation, @@ -471,7 +474,7 @@ const store = createStore({ ; commit('setIsPosting', true); - console.log('payload', payload); + console.log('the social action', payload); return makeFetch('PUT', url, payload) .then(data => {