Skip to content
New issue

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

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

Already on GitHub? # to your account

SpentHours, TotalSpentHours and TotalEstimatedHours null return #246

Open
ntirado89 opened this issue Dec 26, 2019 · 7 comments
Open

SpentHours, TotalSpentHours and TotalEstimatedHours null return #246

ntirado89 opened this issue Dec 26, 2019 · 7 comments
Assignees

Comments

@ntirado89
Copy link

I am using the GetObjects method and the fields SpentHours, TotalSpentHours and TotalEstimatedHours return me null (IMG_01) on the web it shows me the correct information (IMG_02)

@zapadi zapadi self-assigned this Dec 30, 2019
@zapadi
Copy link
Owner

zapadi commented Dec 30, 2019

Hi,
Could you tell me the redmine & redmine api version that you are using?

@ntirado89
Copy link
Author

Environment:
Redmine version 4.0.4.stable
Ruby version 2.5.5-p157 (2019-03-15) [x64-mingw32]
Rails version 5.2.3
Environment production
Database adapter Mysql2
Mailer queue ActiveJob::QueueAdapters::AsyncAdapter
Mailer delivery smtp
SCM:
Git 2.19.1
Filesystem
Redmine plugins:
no plugin installed

@zapadi
Copy link
Owner

zapadi commented Jan 7, 2020

Hi,
I can't reproduce the issue
What is the redmine.net.api version and format(json|xml) that you are using?

@MarcinTroska
Copy link

MarcinTroska commented Sep 6, 2020

Hi @zapadi - got the same issue as the reporter

My Redmine
Environment: Redmine version 3.4.4.stable Ruby version 2.5.1-p57 (2018-03-29) [x86_64-linux-gnu] Rails version 4.2.10 Environment production Database adapter Mysql2 SCM: Filesystem Redmine plugins: no plugin installed

Currently using nuget 4.0.1 - I did also downgrade the version 3 times but nothing changed

My test code

` Console.WriteLine("UpdateIssuesTime called");
var parameters = new NameValueCollection();
parameters.Add(RedmineKeys.STATUS, "New");

        var issues = _redmineManager.GetObjects<Issue>(parameters);

        Console.WriteLine($"var count {issues.Count()}");
        
        foreach (var issue in issues)
        {
            decimal workHours = 0;

            try
            {
                var timeParameters = new NameValueCollection();
                timeParameters.Add(RedmineKeys.ISSUE_ID, issue.Id.ToString());
                var timeTackers = _redmineManager.GetObjects<TimeEntry>(timeParameters);


                foreach (var item in timeTackers)
                {
                    try
                    {
                        workHours += item.Hours;
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }

                    Console.WriteLine("workHours increased to : " + workHours);
                }
            }
            catch (Exception ex)
            {

                Console.WriteLine(ex.Message);
            }


            var estimationTime = issue.EstimatedHours ?? 0;

            Console.WriteLine($"ID: {issue.Id}");
            Console.WriteLine($"workHours: {issue?.TotalSpentHours}");
            Console.WriteLine($"workHours2: {workHours}");
            Console.WriteLine($"estimationTime: {issue?.EstimatedHours}");

            UpdateIssueTime(issue.Id.ToString(), (estimationTime - (float)workHours).ToString());`

At the moment i have 2 issues - both with EstimatedHours set to 20, only one issue has 2 TimeEntries each property for issue spent hours returns null.

But when I use _redmineManager.GetObjects for TimeEntry the entry for id 2 returns the correct hours and for id 1 it throws a nullreference exception.

any idea?

@zapadi
Copy link
Owner

zapadi commented Sep 11, 2020

Hello @MarcinTroska ,

I'll get back to you as soon as I have an answer to your issue.

@gpapotti
Copy link

gpapotti commented Nov 3, 2020

Same problem here. Redmine version 4.0.1.stable, RedmineApi 4.2.0

@zapadi
Copy link
Owner

zapadi commented Dec 8, 2020

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

No branches or pull requests

4 participants