Body: <p>We noticed that at some point, the CiviDiscount reports for number of times a code has been used is reporting duplicates: i.e. for every one transaction that is made using a discount code, the code is being reported as having been used twice. So a user with one transaction will show up twice in the report. The only exception to this <em>per code</em> are transactions that were processed by a staff user though the back end.</p>
  
  <p>Note: this is not happening with all codes but there seems to be no consistency or discernible different between affected codes and non-affected codes. I checked the fields in MySQL to see if it was an issue with the display or the way the data is being recorded and the each duplicate is separate, distinct records in mysql. This is only happening with codes where a financial exchange happens, but not if the discount is 100%.</p>
  
  <p><em>In the screenshot below, you can see that there were two separate records of a discount being used for one user who only has one recorded transaction. The records are 3 seconds apart.</em></p>
  
  <p><a href="https://i.sstatic.net/hycIY.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/hycIY.png" alt="enter image description here"></a></p>
  
  <p>CiviCRM 5.3.1 and CiviDiscount 3.5.</p>
  
  <p>Edit: We are now on 5.4.0 and the problem is still occurring. </p>
  
  <p>Edit2: We are now on 5.11.0 and CiviDiscount 3.7 and the problem is occurring again.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-10-03T18:17:19.023Z
Comments.Text: I noticed that the affected codes (or at least some) had a $sign in the discount amount field. I removed that and we'll see if it solves the problem!
Comments.UserDisplayName: Christia
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-05T14:24:58.647Z
Comments.Text: We have a client on 5.6.1 and CiviDiscount 3.6, and this is occurring for them.  There is no $sign in the discount amount field and it is not occurring consistently on every transaction.  There doesn't seem to be a rhyme or reason to it.
Comments.UserDisplayName: Lesley Carter - BackOffice
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-05T14:30:38.873Z
Comments.Text: I think the dollar sign fixed it for us but have you tried upgrading the extension? 3.7 is available now.
Comments.UserDisplayName: Christia
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-06T15:05:57.097Z
Comments.Text: 3.7 is only stable for CiviCRM 5.8, so that's not an option just yet.  Thanks for responding so quickly!
Comments.UserDisplayName: Lesley Carter - BackOffice
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-04-15T04:20:55.333Z
Comments.Text: I'm having this issue again. I will post an answer if I ever figure it out!
Comments.UserDisplayName: Christia
Tags: <drupal><cividiscount>
Title: Transactions using a discount code create duplicate code-use records
ThreadText: # Transactions using a discount code create duplicate code-use records
  
  (Asked by: username_0 on 2018-08-14)
  
  We noticed that at some point, the CiviDiscount reports for number of times a code has been used is reporting duplicates: i.e. for every one transaction that is made using a discount code, the code is being reported as having been used twice. So a user with one transaction will show up twice in the report. The only exception to this *per code* are transactions that were processed by a staff user though the back end.
  
  Note: this is not happening with all codes but there seems to be no consistency or discernible different between affected codes and non-affected codes. I checked the fields in MySQL to see if it was an issue with the display or the way the data is being recorded and the each duplicate is separate, distinct records in mysql. This is only happening with codes where a financial exchange happens, but not if the discount is 100%.
  
  *In the screenshot below, you can see that there were two separate records of a discount being used for one user who only has one recorded transaction. The records are 3 seconds apart.*
  
  [![enter image description here](https://i.sstatic.net/hycIY.png)](https://i.sstatic.net/hycIY.png)
  
  CiviCRM 5.3.1 and CiviDiscount 3.5.
  
  Edit: We are now on 5.4.0 and the problem is still occurring.
  
  Edit2: We are now on 5.11.0 and CiviDiscount 3.7 and the problem is occurring again.
  
  **Tags:** drupal, cividiscount
  
  > **Comments:**
  > **username_0**: I noticed that the affected codes (or at least some) had a $sign in the discount amount field. I removed that and we'll see if it solves the problem!  
  > **username_1**: We have a client on 5.6.1 and CiviDiscount 3.6, and this is occurring for them.  There is no $sign in the discount amount field and it is not occurring consistently on every transaction.  There doesn't seem to be a rhyme or reason to it.  
  > **username_0**: I think the dollar sign fixed it for us but have you tried upgrading the extension? 3.7 is available now.  
  > **username_1**: 3.7 is only stable for CiviCRM 5.8, so that's not an option just yet.  Thanks for responding so quickly!  
  > **username_0**: I'm having this issue again. I will post an answer if I ever figure it out!  
  
  ---
  
  ## 0 answers
  
  