From f00824d40f7510d45ee780e8aa4da710da11a6b6 Mon Sep 17 00:00:00 2001
From: thomasmars <thomasmars87@gmail.com>
Date: Fri, 30 Nov 2018 14:06:14 +0100
Subject: [PATCH] Fix not running data_postprocessing two times on newer Moodle
 versions

Prepare for release 1.14
---
 mod_form.php | 18 +++++++++++-------
 version.php  |  4 ++--
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/mod_form.php b/mod_form.php
index ba42b02..fbad290 100644
--- a/mod_form.php
+++ b/mod_form.php
@@ -372,15 +372,19 @@ class mod_hvp_mod_form extends moodleform_mod {
      * @return object submitted data; NULL if not valid or not submitted or cancelled
      */
     public function get_data() {
+        global $CFG;
         $data = parent::get_data();
-        if ($data) {
-            // Convert the grade pass value - we may be using a language which uses commas,
-            // rather than decimal points, in numbers. These need to be converted so that
-            // they can be added to the DB.
-            if (isset($data->gradepass)) {
-                $data->gradepass = unformat_float($data->gradepass);
+        // Check if Moodle version is < 3.2
+        if ($CFG->version < 2016120500) {
+            if ($data) {
+                // Convert the grade pass value - we may be using a language which uses commas,
+                // rather than decimal points, in numbers. These need to be converted so that
+                // they can be added to the DB.
+                if (isset($data->gradepass)) {
+                    $data->gradepass = unformat_float($data->gradepass);
+                }
+                $this->data_postprocessing($data);
             }
-            $this->data_postprocessing($data);
         }
         return $data;
     }
diff --git a/version.php b/version.php
index dc3caeb..d319b15 100644
--- a/version.php
+++ b/version.php
@@ -23,9 +23,9 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2018112200;
+$plugin->version   = 2018113000;
 $plugin->requires  = 2013051403;
 $plugin->cron      = 0;
 $plugin->component = 'mod_hvp';
 $plugin->maturity  = MATURITY_STABLE;
-$plugin->release   = '1.13';
+$plugin->release   = '1.14';
-- 
GitLab