diff --git a/app/views/api/pm/weekly_issues/_simple_detail.json.jbuilder b/app/views/api/pm/weekly_issues/_simple_detail.json.jbuilder new file mode 100644 index 000000000..237e43f94 --- /dev/null +++ b/app/views/api/pm/weekly_issues/_simple_detail.json.jbuilder @@ -0,0 +1,55 @@ +json.(issue, :id, :subject, :project_issues_index) +json.blockchain_token_num (Site.has_blockchain? && issue.project&.use_blockchain) ? issue.blockchain_token_num : nil +json.created_at issue.created_on.strftime("%Y-%m-%d %H:%M") +json.updated_at issue.updated_on.strftime("%Y-%m-%d %H:%M") +json.tags issue.show_issue_tags.each do |tag| + json.partial! "api/v1/issues/issue_tags/simple_detail", locals: {tag: tag} +end +json.status_name issue.issue_status&.name +json.status_id issue.status_id +json.status do + if issue.issue_status.present? + json.partial! "api/v1/issues/statues/simple_detail", locals: {status: issue.issue_status} + else + json.nil! + end +end +json.priority_name issue.priority&.name +json.priority_id issue.priority_id +json.priority do + if issue.priority.present? + json.partial! "api/v1/issues/issue_priorities/simple_detail", locals: {priority: issue.priority} + else + json.nil! + end +end +json.milestone_name issue.version&.name +json.milestone_id issue.fixed_version_id +json.root_id issue.root_id +json.pm_issue_type issue.pm_issue_type +json.pm_sprint_id issue.pm_sprint_id +json.pm_project_id issue.pm_project_id +json.time_scale issue.time_scale +if weekly_begin_date.present? && weekly_end_date.present? + if params[:pm_issue_types].present? + json.child_count issue.children_issues.where(pm_issue_type: 4).where("due_date >=? and start_date <=?", weekly_begin_date, weekly_end_date).count + else + json.child_count issue.children_issues.where("due_date >=? and start_date <=?", weekly_begin_date, weekly_end_date).count + end +else + if params[:pm_issue_types].present? + json.child_count issue.children_issues.where(pm_issue_type: 4).count + else + json.child_count issue.child_count + end +end + +json.author do + json.partial! "api/v1/users/simple_user", locals: {user: issue.user} +end +json.assigners issue.show_assigners.each do |assigner| + json.partial! "api/v1/users/simple_user", locals: {user: assigner} +end +json.comment_journals_count issue.comment_journals.size +json.start_date issue.start_date +json.due_date issue.due_date \ No newline at end of file diff --git a/app/views/api/pm/weekly_issues/personal_issues.json.jbuilder b/app/views/api/pm/weekly_issues/personal_issues.json.jbuilder index 0580869a1..6c2f67909 100644 --- a/app/views/api/pm/weekly_issues/personal_issues.json.jbuilder +++ b/app/views/api/pm/weekly_issues/personal_issues.json.jbuilder @@ -1,8 +1,8 @@ json.this_week_all_issues @this_week_all_issues.each do |issue| - json.partial! "api/v1/issues/simple_detail", locals: {issue: issue, weekly_begin_date: @weekly_begin_date, weekly_end_date: @weekly_end_date} + json.partial! "api/pm/weekly_issues/simple_detail", locals: {issue: issue, weekly_begin_date: @weekly_begin_date, weekly_end_date: @weekly_end_date} end json.this_week_total_count @this_week_all_issues.total_count json.next_week_all_issues @next_week_all_issues.each do |issue| - json.partial! "api/v1/issues/simple_detail", locals: {issue: issue, weekly_begin_date: @weekly_begin_date+1.week, weekly_end_date: @weekly_end_date+1.week} + json.partial! "api/pm/weekly_issues/simple_detail", locals: {issue: issue, weekly_begin_date: @weekly_begin_date+1.week, weekly_end_date: @weekly_end_date+1.week} end json.next_week_total_count @next_week_all_issues.total_count \ No newline at end of file diff --git a/app/views/api/v1/issues/_simple_detail.json.jbuilder b/app/views/api/v1/issues/_simple_detail.json.jbuilder index 237e43f94..6207ab80b 100644 --- a/app/views/api/v1/issues/_simple_detail.json.jbuilder +++ b/app/views/api/v1/issues/_simple_detail.json.jbuilder @@ -30,20 +30,11 @@ json.pm_issue_type issue.pm_issue_type json.pm_sprint_id issue.pm_sprint_id json.pm_project_id issue.pm_project_id json.time_scale issue.time_scale -if weekly_begin_date.present? && weekly_end_date.present? - if params[:pm_issue_types].present? - json.child_count issue.children_issues.where(pm_issue_type: 4).where("due_date >=? and start_date <=?", weekly_begin_date, weekly_end_date).count - else - json.child_count issue.children_issues.where("due_date >=? and start_date <=?", weekly_begin_date, weekly_end_date).count - end -else - if params[:pm_issue_types].present? - json.child_count issue.children_issues.where(pm_issue_type: 4).count - else - json.child_count issue.child_count - end +if params[:pm_issue_types].present? + json.child_count issue.children_issues.where(pm_issue_type: 4).count +else + json.child_count issue.child_count end - json.author do json.partial! "api/v1/users/simple_user", locals: {user: issue.user} end