MerginMaps / MerginMaps/mobile

Photo naming expression fails if replacing a photo with the same filename

Open
#3,600 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

  • #4105 by @Withalion — closed without merging
bug photo-refactoring
Dominant language
C++
Stars
388
Forks
87
Avg merge
2d 7h
Merged PRs (30d)
20

Description

Replacing a photo on a field that uses a photo naming expression results in the photo not being renamed if the resulting filename is the same as the file being replaced. This can cause issues in cases where a user needs to change the photo attached to a feature where a file naming expression is being used.

To recreate the issue, you can use this project.

  1. Create a project that has a photo attachment field in the survey layer and at least one other field that will have a human readable name with a unique constraint (in this example it is the "name" field).
  2. In Project>Properties>Mergin set an expression that will result in a file name that is unique to the feature but not necessarily unique if another photo is taken for the feature. In the example project we use: to_date(now())||'_'||"name"||'-photo1'
  3. Sync the project from QGIS and download it in the mobile app
  4. Record a new feature and attach a photo in the photo widget then save the feature
  5. Go to More>Local changes to check that the correct photo name has been used for the photo
  6. Select the feature on the map and click 'Edit'
  7. Delete the existing photo and take a new one
  8. Save the feature and go to More>Local changes and the new photo should not have the correct photo name

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked reproduction project and follow the listed steps to reproduce replacement of a photo whose expression-derived filename is unchanged. Trace the mobile photo replacement flow; done means replacing an existing photo produces the correct expression-based filename in Local changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.