Coder Social home page Coder Social logo

SQL Error about agiledwarf HOT 5 OPEN

iressources avatar iressources commented on June 17, 2024
SQL Error

from agiledwarf.

Comments (5)

markablov avatar markablov commented on June 17, 2024

Redmine version?
Mysql version?
Thanks.

from agiledwarf.

chesterman avatar chesterman commented on June 17, 2024

Ops, sorry for the lack of info.

Redmine 1.4.4
PostgreSQL 9.1.4

from agiledwarf.

chesterman avatar chesterman commented on June 17, 2024

I fixed the SQL... kind of. There were just a few things that make it incompatible with PostgreSQL.
The problem is that the outer query does a group by in 3 of the 4 fields, so the remaing field MUST be in a aggregation function, like max(). I used SUM() in the example, but i dont know what the sql is supposed to return, so i ask you to alter:

select 
    sum(COALESCE(old_value::float,0)) as value,
    journalized_id as issueID,
    prop_key,
    DATE(journals.created_on) AS created_on 
from 
    journals
inner join
    journal_details on (journals.id = journal_id)
inner join
    issues on (issues.id = journalized_id)
where
    journalized_type = 'Issue' 
    and
    property = 'attr'
    and
    (prop_key = 'estimated_hours' or prop_key = 'done_ratio')
    and #{restcondchanges}
group by
    2, 3, 4
order by
    created_on desc

from agiledwarf.

markablov avatar markablov commented on June 17, 2024

Main idea of grouping in same way is to recieve last day value;
For example if we edit same parameter of same issue several times of day, we need to count latest change.
That's why in inner query we should order by id to recieve actual value.

from agiledwarf.

kWhittington avatar kWhittington commented on June 17, 2024

Thank you so much for the post @chesterman!

Replacing the queries with your's solved my error of the Run Charts tab crashing.
However, judging by the other issues, I might not be able to really play with the plugin much. :(

from agiledwarf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.