Skip to content

Commit 962cd6a

Browse files
committed
Show credit hours/hours if present on education card
1 parent f7c2c3b commit 962cd6a

4 files changed

Lines changed: 39 additions & 19 deletions

File tree

app/app/services/education_activity_card_builder.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,12 @@ def validated_month_data(month_start:, effective_term:)
7171
end
7272

7373
def partial_self_attested_month_data(term:, month_start:)
74+
credit_hours = @activity.review_term_credit_hours(term)
7475
{
7576
month: month_start,
76-
enrollment_status: term.enrollment_status_display
77+
enrollment_status: term.enrollment_status_display,
78+
credit_hours: credit_hours,
79+
community_engagement_hours: @activity.community_engagement_hours(credit_hours)
7780
}
7881
end
7982

app/app/views/activities/activities/index.html.erb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,10 @@
156156
<div class="activity-month-details__data">
157157
<% if month_data[:enrollment_status].present? %>
158158
<p class="margin-y-0"><%= t("activities.hub.cards.enrollment_status", status: month_data[:enrollment_status]) %></p>
159-
<% else %>
160-
<p class="margin-y-0"><%= t("activities.hub.cards.credit_hours", amount: month_data[:credit_hours]) %></p>
161-
<p class="margin-y-0"><%= t("activities.hub.cards.hours", count: month_data[:community_engagement_hours]) %></p>
159+
<% end %>
160+
<% if month_data[:credit_hours].present? %>
161+
<p class="margin-y-0"><%= t("activities.hub.cards.credit_hours", amount: format_decimal_amount(month_data[:credit_hours])) %></p>
162+
<p class="margin-y-0"><%= t("activities.hub.cards.hours", count: format_decimal_amount(month_data[:community_engagement_hours])) %></p>
162163
<% end %>
163164
</div>
164165
</div>

app/spec/controllers/activities/activities_controller_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -648,16 +648,16 @@
648648
get :index
649649
end
650650

651-
it "shows only enrollment status on the education card" do
651+
it "shows enrollment status alongside credit hours on the education card" do
652652
expect(response.body).to include("Test University")
653653
expect(response.body).to include(
654654
I18n.t(
655655
"activities.hub.cards.enrollment_status",
656656
status: I18n.t("components.enrollment_term_table_component.status.less_than_half_time")
657657
)
658658
)
659-
expect(response.body).not_to include(I18n.t("activities.hub.cards.credit_hours", amount: 4))
660-
expect(response.body).not_to include(I18n.t("activities.hub.cards.hours", count: 52))
659+
expect(response.body).to include(I18n.t("activities.hub.cards.credit_hours", amount: 4))
660+
expect(response.body).to include(I18n.t("activities.hub.cards.hours", count: 52))
661661
expect(response.body).not_to include(I18n.t("activities.hub.empty.education"))
662662
end
663663

@@ -719,8 +719,8 @@
719719
status: I18n.t("components.enrollment_term_table_component.status.less_than_half_time")
720720
)
721721
).length).to eq(2)
722-
expect(response.body).not_to include(I18n.t("activities.hub.cards.credit_hours", amount: 3))
723-
expect(response.body).not_to include(I18n.t("activities.hub.cards.credit_hours", amount: 5))
722+
expect(response.body).to include(I18n.t("activities.hub.cards.credit_hours", amount: 3))
723+
expect(response.body).to include(I18n.t("activities.hub.cards.credit_hours", amount: 5))
724724
end
725725
end
726726

app/spec/helpers/activities_helper_spec.rb

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -507,16 +507,20 @@
507507
expect(result.first[:months]).to eq([
508508
{
509509
month: first_month,
510-
enrollment_status: I18n.t("components.enrollment_term_table_component.status.less_than_half_time")
510+
enrollment_status: I18n.t("components.enrollment_term_table_component.status.less_than_half_time"),
511+
credit_hours: 3,
512+
community_engagement_hours: 39
511513
},
512514
{
513515
month: second_month,
514-
enrollment_status: I18n.t("components.enrollment_term_table_component.status.less_than_half_time")
516+
enrollment_status: I18n.t("components.enrollment_term_table_component.status.less_than_half_time"),
517+
credit_hours: 5,
518+
community_engagement_hours: 65
515519
}
516520
])
517521
end
518522

519-
it "shows enrollment status only for partially self-attested months" do
523+
it "shows enrollment status and credit hours for partially self-attested months" do
520524
activity = create(:education_activity, activity_flow: flow, data_source: :partially_self_attested)
521525
create(
522526
:nsc_enrollment_term,
@@ -533,11 +537,15 @@
533537
expect(result.first[:months]).to eq([
534538
{
535539
month: first_month,
536-
enrollment_status: I18n.t("components.enrollment_term_table_component.status.less_than_half_time")
540+
enrollment_status: I18n.t("components.enrollment_term_table_component.status.less_than_half_time"),
541+
credit_hours: 6,
542+
community_engagement_hours: 78
537543
},
538544
{
539545
month: second_month,
540-
enrollment_status: I18n.t("components.enrollment_term_table_component.status.less_than_half_time")
546+
enrollment_status: I18n.t("components.enrollment_term_table_component.status.less_than_half_time"),
547+
credit_hours: 6,
548+
community_engagement_hours: 78
541549
}
542550
])
543551
end
@@ -560,7 +568,9 @@
560568
expect(result.first[:months].first).to eq(
561569
{
562570
month: first_month,
563-
enrollment_status: I18n.t("components.enrollment_term_table_component.status.less_than_half_time")
571+
enrollment_status: I18n.t("components.enrollment_term_table_component.status.less_than_half_time"),
572+
credit_hours: 4,
573+
community_engagement_hours: 52
564574
}
565575
)
566576
end
@@ -591,12 +601,14 @@
591601
expect(result.first[:months]).to eq([
592602
{
593603
month: second_month,
594-
enrollment_status: I18n.t("components.enrollment_term_table_component.status.less_than_half_time")
604+
enrollment_status: I18n.t("components.enrollment_term_table_component.status.less_than_half_time"),
605+
credit_hours: 5,
606+
community_engagement_hours: 65
595607
}
596608
])
597609
end
598610

599-
it "shows enrollment status only for enrolled partially self-attested months" do
611+
it "shows enrollment status and credit hours for enrolled partially self-attested months" do
600612
activity = create(:education_activity, activity_flow: flow, data_source: :partially_self_attested)
601613
create(
602614
:nsc_enrollment_term,
@@ -613,11 +625,15 @@
613625
expect(result.first[:months]).to eq([
614626
{
615627
month: first_month,
616-
enrollment_status: I18n.t("components.enrollment_term_table_component.status.enrolled")
628+
enrollment_status: I18n.t("components.enrollment_term_table_component.status.enrolled"),
629+
credit_hours: 5,
630+
community_engagement_hours: 65
617631
},
618632
{
619633
month: second_month,
620-
enrollment_status: I18n.t("components.enrollment_term_table_component.status.enrolled")
634+
enrollment_status: I18n.t("components.enrollment_term_table_component.status.enrolled"),
635+
credit_hours: 5,
636+
community_engagement_hours: 65
621637
}
622638
])
623639
end

0 commit comments

Comments
 (0)