Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get the last value and last update value in custom field #327

Open
ashrafalzyoud opened this issue Oct 26, 2023 · 3 comments
Open

get the last value and last update value in custom field #327

ashrafalzyoud opened this issue Oct 26, 2023 · 3 comments
Labels

Comments

@ashrafalzyoud
Copy link

ashrafalzyoud commented Oct 26, 2023

hi all
thx for very important plugin

how i can get the last value of cfs[1]
how i can get the last update value of cfs[1]

  self.custom_field_values = { 10=> CustomValue.where( custom_field_id: 1).last }
  self.custom_field_values = { 11=> CustomValue.where(custom_field_id: 1).update }
@picman
Copy link
Collaborator

picman commented Oct 27, 2023

  1. CustomValue.where( custom_field_id: 1).last is perfectly fine.
  2. What do you mean with 'last update value'? Custom values don't keep any time stamp just the value.

@ashrafalzyoud
Copy link
Author

Table
Name value
A. 1
B. 2
C. 3
D. 4

The last value 4
If I need last change value

Name value
A. 1
B. 6 // change value
C. 3
D. 4

How I can know the last change value

@picman
Copy link
Collaborator

picman commented Dec 1, 2023

You would have to look into journal and journal_details tables to find out when was which custom value changed.

These two records correspond with a change of custom value (CF 22) of issue ID 94029.

MariaDB [redmine]> select * from journals order by created_on desc limit 1\G;

              id: 231500
  journalized_id: 94029
journalized_type: Issue
         user_id: 1935
           notes: 
      created_on: 2023-12-01 14:26:54
     updated_on: 2023-12-01 14:26:54
   updated_by_id: NULL
   private_notes: 0
1 row in set (0,001 sec)

ERROR: No query specified

MariaDB [redmine]> select * from journal_details where journal_id = 231500\G

        id: 352696
journal_id: 231500
  property: cf
  prop_key: 22
 old_value: 
     value: Nice to have

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants