Skip to content

Conversation

pylipp
Copy link
Contributor

@pylipp pylipp commented Oct 6, 2025

https://trello.com/c/70vc78uU

  • Don't log QR code generation to history table
  • Add comments
  • Remove handling of legacy QR code
  • Correctly use simpleBulkSaveChangeHistory

@pylipp pylipp requested a review from Copilot October 6, 2025 13:37
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR removes unnecessary logging of QR code generation to the history table, improves code documentation, and cleans up legacy QR code handling. The changes streamline QR code generation by eliminating redundant history entries while maintaining proper tracking of when boxes receive new QR codes.

Key changes:

  • Removed history logging for QR code generation events
  • Added clarifying comments to QR code generation logic
  • Removed legacy QR code handling and database fields
  • Consolidated history logging to track only when boxes get new QR codes

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
pdf/qr.php Removed legacy QR code handling, consolidated history logging, and added explanatory comments
include/qr.php Removed QR code generation history logging and added section comments

Copy link
Member

@HaGuesto HaGuesto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pylipp I'm missing here the db migration to remove the old QR history entries.

Also it is removing the legacy bits which we maybe should investigate how important that still is. I can explain the origin of the legacy flag.

@HaGuesto
Copy link
Member

HaGuesto commented Oct 9, 2025

@pylipp pls check in production if there are any active QR-code who are legacy QR-codes that are not part of Drop in the Ocean.

@pylipp
Copy link
Contributor Author

pylipp commented Oct 13, 2025

Also it is removing the legacy bits which we maybe should investigate how important that still is. I can explain the origin of the legacy flag.

Agreed with @HaGuesto : not relevant since the only partner of legacy QR codes, DitO, is not with us anymore.

@pylipp pls check in production if there are any active QR-code who are legacy QR-codes that are not part of Drop in the Ocean.

There's 17k QR codes with the legacy flag but 0 connected to boxes in active camps:

select count(qr.id) from qr
inner join stock b on b.qr_id = qr.id
inner join locations l on l.id = b.location_id 
inner join camps c on c.id = l.camp_id 
where legacy = 1 
and (b.deleted is null or not b.deleted)
and (l.deleted is null or not l.deleted)
and (c.deleted is null or not c.deleted)
;

In camps of other orgs, there are 4 legacy QR codes in an inactive R4R camp and 3 legacy QR codes with deleted boxes/locations in IHA's camp (QR codes were created in 2017 and 2018; these boxes were moved from DitO to IHA in 2021/2022).

select c.id,b.box_state_id ,qr.created,b.created ,b.deleted ,l.deleted , c.deleted from qr
inner join stock b on b.qr_id = qr.id
inner join locations l on l.id = b.location_id 
inner join camps c on c.id = l.camp_id 
where legacy = 1 
and c.organisation_id != 10
order by c.id
;

There are no legacy QR codes in any active bases anymore
This removes the entries

```
changes                     |count(id)| max(changedate)
----------------------------+---------+
New QR-code generated       |    42391| -- 2024-06-24 (see below. There are 30 newer log entries since 2025-08-25 through the v2 createQrCode functionality)
New QR-code generated by pdf|    97198| -- 2024-06-24 (in Feb 2024, the underlying simpleBulkSaveChangeHistory function was incorrectly updated (98be57f); released in v1.24.0 on 2024-06-25)
QR code associated to box.  |    62519| -- 2023-12-06 (in Nov 2023, the corresponding mobile functionality was deleted; released in v1.23.4 on 2023-12-08)
```
@pylipp pylipp force-pushed the remove-logging-qr-code-generation-to-history branch from 3812915 to 885b8ca Compare October 13, 2025 11:00
@pylipp
Copy link
Contributor Author

pylipp commented Oct 13, 2025

@pylipp I'm missing here the db migration to remove the old QR history entries.

added it now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants