Skip to content

Commit

Permalink
Adds optional param channel_id to TeachingEventAddAttendee (#1330)
Browse files Browse the repository at this point in the history
Teams need to be able to attribute event sign-ups in the same way that they
do for mailing list and adviser with a query parameter in the format ?channel={channel_id}

Link to Trello card: 
https://trello.com/c/hEzzR5IP/5001-investigate-bam-channel-capture-for-events

* Adds optional param `channel_id` to TeachingEventAddAttendee
* Adds Unit test
  • Loading branch information
ekumachidi authored Jan 4, 2024
1 parent 8080c9d commit 27bccea
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ public class TeachingEventAddAttendee

[SwaggerSchema(WriteOnly = true)]
public Guid? EventId { get; set; }

[SwaggerSchema(WriteOnly = true)]
public int? ChannelId { get; set; }

[SwaggerSchema(WriteOnly = true)]
public Guid? AcceptedPolicyId { get; set; }
public Guid? PreferredTeachingSubjectId { get; set; }
Expand Down Expand Up @@ -136,7 +140,7 @@ private void ConfigureChannel(Candidate candidate)
{
if (CandidateId == null)
{
candidate.ChannelId = (int?)Candidate.Channel.Event;
candidate.ChannelId = ChannelId ?? (int?)Candidate.Channel.Event;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,14 @@ public void Candidate_ChannelIdWhenCandidateIdIsNull_IsMailingList()
request.Candidate.ChannelId.Should().Be((int)Candidate.Channel.Event);
}

[Fact]
public void Candidate_WithNonNullChannelIdWhenCandidateIdIsNull_IsMailingList()
{
var request = new TeachingEventAddAttendee() { CandidateId = null, ChannelId = 456 };

request.Candidate.ChannelId.Should().Be(456);
}

[Fact]
public void Candidate_ChannelIdWhenCandidateIdIsNotNull_IsNotChanged()
{
Expand Down

0 comments on commit 27bccea

Please sign in to comment.