Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
Kopczuch committed Jun 7, 2024
1 parent 6fbedd4 commit bb87101
Show file tree
Hide file tree
Showing 9 changed files with 216 additions and 50 deletions.
2 changes: 1 addition & 1 deletion backend/Controllers/UserStoryApiController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace PlanningPoker.Controllers
{
[Route("api/userStories")]
[Route("api/user-stories")]
[ApiController]
public class UserStoryApiController : ControllerBase
{
Expand Down
188 changes: 188 additions & 0 deletions backend/Migrations/20240607210837_Main-Bug.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions backend/Migrations/20240607210837_Main-Bug.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace PlanningPoker.Migrations
{
/// <inheritdoc />
public partial class MainBug : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{

}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{

}
}
}
1 change: 0 additions & 1 deletion backend/Models/UserStory/UserStoryTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public UserStoryTask(int userStoryId, string csvTask)
public string Title { get; set; }
public string Description { get; set; }
public string EstimationResult { get; set; }
public bool CurrentlyEvaluated { get; set; } = false;
public int UserStoryId { get; set; }

public string ToCsvString()
Expand Down
2 changes: 1 addition & 1 deletion backend/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static void Main(string[] args)
options.AddPolicy(name: myAllowSpecificOrigins,
policy =>
{
policy.WithOrigins("https://planningpokerinf1337.vercel.app", "https://planningpokerinf1337.vercel.app/room")
policy.WithOrigins("https://planningpokerinf1337.vercel.app", "https://localhost:3000", "http://localhost:3000")
.AllowAnyMethod()
.AllowAnyHeader()
.AllowCredentials();
Expand Down
3 changes: 0 additions & 3 deletions backend/Services/UserStoryService/IUserStoryService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,5 @@ public interface IUserStoryService

Task<string> EstimateTaskValue(int userStoryTaskId, IList<VotingResults> votingResults, VotingSystem votingSystem);
Task<UserStoryTask?> GetUserStoryTaskById(int userStoryTaskId);

Task<UserStoryTask?> GetCurrentVotingTask();
Task SetCurrentEvaluatedTask(int userStoryTaskId);
}
}
24 changes: 0 additions & 24 deletions backend/Services/UserStoryService/UserStoryService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -365,29 +365,5 @@ private string EvaluateResults(IList<VotingResults> results, VotingSystem voting
return string.Empty;
}


public async Task<UserStoryTask?> GetCurrentVotingTask()
{
return await _dbContext.UserStoryTasks.FirstOrDefaultAsync(t => t.CurrentlyEvaluated);
}

public async Task SetCurrentEvaluatedTask(int userStoryTaskId)
{
var tasksToReset = await _dbContext.UserStoryTasks.Where(t => t.CurrentlyEvaluated).ToListAsync();

foreach (var task in tasksToReset)
{
task.CurrentlyEvaluated = false;
}

var newTask = await _dbContext.UserStoryTasks.FindAsync(userStoryTaskId);

if (newTask == null)
throw new Exception("No task with given ID");

newTask.CurrentlyEvaluated = true;

await _dbContext.SaveChangesAsync();
}
}
}
16 changes: 0 additions & 16 deletions backend/SignalR/Hubs/RoomHub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,6 @@ public async Task JoinRoom(int roomId, string participantName)

var votingState = _roomService.GetVotingState(room);
await Clients.Group(groupName).SendAsync("VotingState", votingState);

//await GetCurrentVotingTask(groupName);
}

private async Task GetCurrentVotingTask(string groupName)
{
var userStoryTask = await _userStoryService.GetCurrentVotingTask();

if (userStoryTask == null)
return;

await Clients.Caller.SendAsync("VotingStart", userStoryTask);
await Clients.Group(groupName).SendAsync("TaskEstimation", null);
}

public async Task SubmitVote(int roomId, string participantName, string? voteValue, int userStoryTaskId)
Expand Down Expand Up @@ -226,9 +213,6 @@ public async Task SetVotedTask(int roomId, int userStoryTaskId)
if (userStoryTask == null)
throw new Exception("No task with given ID");

// Note: For users that joined during vote
//await _userStoryService.SetCurrentEvaluatedTask(userStoryTaskId);

var groupName = GetGroupName(room);

await Clients.Group(groupName).SendAsync("VotingStart", userStoryTask);
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/api/userstory-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ import { config } from "@/config";
export namespace UserStoryApi {

export const listUserStories = async (roomId: number) => {
const result = await api.get<UserStory[]>(`/userStories/${roomId}`);
const result = await api.get<UserStory[]>(`/user-stories/${roomId}`);
return result.data;
};

export const getUserStoryDetails = async (userStoryId: number) => {
const result = await api.get<UserStory>(`/userStories/details/${userStoryId}`);
const result = await api.get<UserStory>(`/user-stories/details/${userStoryId}`);
return result.data;
}

export const exportUserStories = async (roomId: number) => {
const result = await api.get(`/userStories/export/${roomId}`);
const result = await api.get(`/user-stories/export/${roomId}`);
return result.data;
}

Expand All @@ -28,7 +28,7 @@ export namespace UserStoryApi {
body: formData
};

const result = await fetch(`${config.baseUrl}/api/userStories/import/${roomId}`, requestOptions);
const result = await fetch(`${config.baseUrl}/api/user-stories/import/${roomId}`, requestOptions);

if (result.ok) {
return 'Import successful';
Expand Down

0 comments on commit bb87101

Please sign in to comment.