Skip to content

Commit 05cb0e0

Browse files
authored
Merge pull request #7 from ississippi/decisions-testing
Decisions testing
2 parents 091350f + 6b70ef3 commit 05cb0e0

File tree

5 files changed

+21
-13
lines changed

5 files changed

+21
-13
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
################################################################################
2+
# This .gitignore file was automatically created by Microsoft(R) Visual Studio.
3+
################################################################################
4+
5+
/favicon_io

NotificationsService/NotificationsService/Controllers/PrController.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ public IActionResult ListRoutes()
4343
[HttpGet("openprs")]
4444
public async Task<IActionResult> GetOpenPrs()
4545
{
46-
_logger.LogInformation("Received request to get all open PRs.");
46+
_logger.LogDebug("Received request to get all open PRs.");
4747
try
4848
{
4949
var dynamoService = new DynamoService(_logger);
50-
_logger.LogInformation("Received request to get PR Details.");
50+
_logger.LogDebug("Received request to get PR Details.");
5151
var allReviews = await dynamoService.GetAllReviewsAsync();
5252
// Create a list to hold the processed reviews
5353
var processedReviews = new List<object>();
@@ -92,9 +92,9 @@ public async Task<IActionResult> GetDetails([FromQuery] int id, string repo)
9292
try
9393
{
9494
var dynamoService = new DynamoService(_logger);
95-
_logger.LogInformation("Received request to get PR Details.");
95+
_logger.LogDebug("Received request to get PR Details.");
9696
var prItem = await dynamoService.GetReviewByIdAsync(id, repo);
97-
//_logger.LogInformation($"prItem from DDB: {prItem}");
97+
_logger.LogDebug($"prItem from DDB: {prItem}");
9898
if (prItem != null)
9999
{
100100
var metadataMap = prItem["metadata"].M; // Step 1: get the map
@@ -126,7 +126,7 @@ public async Task<IActionResult> GetDetails([FromQuery] int id, string repo)
126126
[HttpGet("review")]
127127
public IActionResult GetReview([FromQuery] int prNumber)
128128
{
129-
_logger.LogInformation("Received request to get Review.");
129+
_logger.LogDebug("Received request to get Review.");
130130
// TODO: Replace with real PR review generation
131131
string mockReview = $"This is an autogenerated review for PR #{prNumber}. It looks good overall but could use minor improvements.";
132132

@@ -137,7 +137,7 @@ public IActionResult GetReview([FromQuery] int prNumber)
137137
[HttpPost("feedback")]
138138
public IActionResult PostFeedback([FromBody] FeedbackRequest request)
139139
{
140-
_logger.LogInformation($"Received feedback: PR#{request.prNumber}, Vote: {request.vote}");
140+
_logger.LogDebug($"Received feedback: PR#{request.prNumber}, Vote: {request.vote}");
141141
//Console.WriteLine($"Received feedback: PR#{request.PrNumber}, Vote: {request.Vote}");
142142

143143
return Ok(new { message = "Feedback received" });
@@ -147,7 +147,7 @@ public IActionResult PostFeedback([FromBody] FeedbackRequest request)
147147
[HttpPost("decision")]
148148
public IActionResult PostReview([FromBody] DecisionRequest request)
149149
{
150-
_logger.LogInformation($"Received decision: PR#{request.prNumber}, Decision: {request.decision}");
150+
_logger.LogDebug($"Received decision: PR#{request.prNumber}, Decision: {request.decision}");
151151
// call the git service to submit the decision to Git
152152
return Ok(new { message = "Decision received" });
153153
}

NotificationsService/NotificationsService/Controllers/SnsController.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ public async Task<IActionResult> Receive()
2424
{
2525
using var reader = new StreamReader(Request.Body);
2626
var body = await reader.ReadToEndAsync();
27-
//_logger.LogInformation("Receive: SNS message received: {0}", body);
28-
_logger.LogInformation("Receive: SNS message received.");
27+
_logger.LogDebug("Receive: SNS message received: {0}", body);
2928

3029
try
3130
{
@@ -50,7 +49,7 @@ public async Task<IActionResult> Receive()
5049
{
5150
try
5251
{
53-
_logger.LogInformation($"Pr_Number: {reviewNotification.metadata.pr_number}");
52+
//_logger.LogInformation($"Pr_Number: {reviewNotification.metadata.pr_number}");
5453
//_logger.LogInformation($"ReviewTitle: {reviewNotification.reviewTitle}");
5554
//_logger.LogInformation($"User_Login: {reviewNotification.metadata.user_login}");
5655
//_logger.LogInformation($"Created_At: {reviewNotification.metadata.created_at}");
@@ -66,7 +65,7 @@ public async Task<IActionResult> Receive()
6665
//review = reviewNotification.review
6766
};
6867
await _prService.BroadcastNewPrAsync(prItem);
69-
_logger.LogInformation($"Review for PR #{prItem.id} sent to BroadcastNewPrAsync().");
68+
//_logger.LogInformation($"Review for PR #{prItem.id} sent to BroadcastNewPrAsync().");
7069
}
7170
catch
7271
{

NotificationsService/NotificationsService/Services/PrService.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,8 +516,7 @@ await removedClient.Socket.CloseAsync(
516516
}
517517
}
518518

519-
_logger.LogInformation("Completed broadcasting PR #{PrId}. Active clients: {Count}",
520-
newPr.id, _clients.Count);
519+
_logger.LogDebug("Completed broadcasting PR #{PrId}. Active clients: {Count}", newPr.id, _clients.Count);
521520
}
522521
finally
523522
{

NotificationsService/NotificationsService/wwwroot/index.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ <h6>Action:</h6>
9393
function renderPrList() {
9494
const list = document.getElementById('pr-list');
9595
list.innerHTML = '';
96+
97+
// Sort PRs by date (most recent first)
98+
prList.sort((a, b) => new Date(b.date) - new Date(a.date));
99+
96100
prList.forEach(pr => {
97101
const item = document.createElement('button');
98102
item.className = 'list-group-item list-group-item-action';
@@ -127,6 +131,7 @@ <h6>Action:</h6>
127131

128132
document.getElementById('pr-list').classList.add('d-none');
129133
document.getElementById('pr-detail').classList.remove('d-none');
134+
document.getElementById("approve").checked = true;
130135

131136
// Convert Review markdown from the model to html for showdown ------------------------------
132137
// Create converter instance with appropriate options

0 commit comments

Comments
 (0)