classroom isActive Participant hataları
This commit is contained in:
parent
08f5d11f28
commit
ab45389299
5 changed files with 15 additions and 15 deletions
|
|
@ -192,7 +192,10 @@ public class ClassroomAppService : PlatformAppService, IClassroomAppService
|
|||
throw new InvalidOperationException("Class not found");
|
||||
}
|
||||
|
||||
var classroomSettings = JsonSerializer.Deserialize<ClassroomSettingsDto>(classSession.SettingsJson);
|
||||
var classroomSettings = string.IsNullOrWhiteSpace(classSession.SettingsJson)
|
||||
? new ClassroomSettingsDto() // default ayarlar
|
||||
: JsonSerializer.Deserialize<ClassroomSettingsDto>(classSession.SettingsJson);
|
||||
|
||||
|
||||
if (classSession.ParticipantCount >= classSession.MaxParticipants)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public class ClassroomHub : Hub
|
|||
}
|
||||
|
||||
[HubMethodName("JoinClass")]
|
||||
public async Task JoinClassAsync(Guid sessionId, Guid userId, string userName, bool isTeacher)
|
||||
public async Task JoinClassAsync(Guid sessionId, Guid userId, string userName, bool isTeacher, bool isActive)
|
||||
{
|
||||
var classroom = await _classSessionRepository.GetAsync(sessionId);
|
||||
if (classroom == null)
|
||||
|
|
@ -51,7 +51,9 @@ public class ClassroomHub : Hub
|
|||
return;
|
||||
}
|
||||
|
||||
var classroomSettings = JsonSerializer.Deserialize<ClassroomSettingsDto>(classroom.SettingsJson);
|
||||
var classroomSettings = string.IsNullOrWhiteSpace(classroom.SettingsJson)
|
||||
? new ClassroomSettingsDto() // default ayarlar
|
||||
: JsonSerializer.Deserialize<ClassroomSettingsDto>(classroom.SettingsJson);
|
||||
|
||||
var participant = await _participantRepository.FirstOrDefaultAsync(
|
||||
x => x.SessionId == sessionId && x.UserId == userId
|
||||
|
|
@ -68,7 +70,7 @@ public class ClassroomHub : Hub
|
|||
classroomSettings.DefaultMicrophoneState == "muted",
|
||||
classroomSettings.DefaultCameraState == "off",
|
||||
false,
|
||||
true
|
||||
isActive
|
||||
);
|
||||
participant.UpdateConnectionId(Context.ConnectionId);
|
||||
await _participantRepository.InsertAsync(participant, autoSave: true);
|
||||
|
|
@ -150,7 +152,7 @@ public class ClassroomHub : Hub
|
|||
x => x.SessionId == sessionId && x.UserId == userId
|
||||
);
|
||||
|
||||
if (participant == null)
|
||||
if (participant != null)
|
||||
{
|
||||
participant.IsActive = false;
|
||||
await _participantRepository.UpdateAsync(participant, autoSave: true);
|
||||
|
|
|
|||
|
|
@ -110,16 +110,17 @@ export class SignalRService {
|
|||
userId: string,
|
||||
userName: string,
|
||||
isTeacher: boolean,
|
||||
isActive: boolean
|
||||
): Promise<void> {
|
||||
if (!this.isConnected) {
|
||||
console.log('Error starting SignalR connection join class for', userName)
|
||||
return
|
||||
}
|
||||
|
||||
console.log('Joining class session:', sessionId, 'as', userName, 'isTeacher:', isTeacher)
|
||||
console.log('Joining class session:', sessionId, 'as', userName, 'isTeacher:', isTeacher, 'isActive:', isActive)
|
||||
|
||||
try {
|
||||
await this.connection.invoke('JoinClass', sessionId, userId, userName, isTeacher)
|
||||
await this.connection.invoke('JoinClass', sessionId, userId, userName, isTeacher, isActive)
|
||||
} catch (error) {
|
||||
console.error('Error joining class:', error)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -189,14 +189,6 @@ const ClassList: React.FC = () => {
|
|||
}
|
||||
}
|
||||
|
||||
// const canJoinClass = (actualStartTime: string) => {
|
||||
// const actualed = new Date(actualStartTime)
|
||||
// const now = new Date()
|
||||
// const tenMinutesBefore = new Date(actualed.getTime() - 10 * 60 * 1000) //10 dakika öncesine kadar
|
||||
// const twoHoursAfter = new Date(actualed.getTime() + 2 * 60 * 60 * 1000) // 2 saat sonrasına kadar
|
||||
// return now >= tenMinutesBefore && now <= twoHoursAfter
|
||||
// }
|
||||
|
||||
const widgets = () => {
|
||||
return {
|
||||
totalCount: classList.length,
|
||||
|
|
|
|||
|
|
@ -404,6 +404,7 @@ const RoomDetail: React.FC = () => {
|
|||
user.id,
|
||||
user.name,
|
||||
user.role === 'teacher',
|
||||
true
|
||||
)
|
||||
} catch (error) {
|
||||
console.error('Failed to initialize services:', error)
|
||||
|
|
@ -646,6 +647,7 @@ const RoomDetail: React.FC = () => {
|
|||
studentId,
|
||||
randomName,
|
||||
false, // öğrenci
|
||||
true // aktif
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue