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");
|
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)
|
if (classSession.ParticipantCount >= classSession.MaxParticipants)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ public class ClassroomHub : Hub
|
||||||
}
|
}
|
||||||
|
|
||||||
[HubMethodName("JoinClass")]
|
[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);
|
var classroom = await _classSessionRepository.GetAsync(sessionId);
|
||||||
if (classroom == null)
|
if (classroom == null)
|
||||||
|
|
@ -51,7 +51,9 @@ public class ClassroomHub : Hub
|
||||||
return;
|
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(
|
var participant = await _participantRepository.FirstOrDefaultAsync(
|
||||||
x => x.SessionId == sessionId && x.UserId == userId
|
x => x.SessionId == sessionId && x.UserId == userId
|
||||||
|
|
@ -68,7 +70,7 @@ public class ClassroomHub : Hub
|
||||||
classroomSettings.DefaultMicrophoneState == "muted",
|
classroomSettings.DefaultMicrophoneState == "muted",
|
||||||
classroomSettings.DefaultCameraState == "off",
|
classroomSettings.DefaultCameraState == "off",
|
||||||
false,
|
false,
|
||||||
true
|
isActive
|
||||||
);
|
);
|
||||||
participant.UpdateConnectionId(Context.ConnectionId);
|
participant.UpdateConnectionId(Context.ConnectionId);
|
||||||
await _participantRepository.InsertAsync(participant, autoSave: true);
|
await _participantRepository.InsertAsync(participant, autoSave: true);
|
||||||
|
|
@ -150,7 +152,7 @@ public class ClassroomHub : Hub
|
||||||
x => x.SessionId == sessionId && x.UserId == userId
|
x => x.SessionId == sessionId && x.UserId == userId
|
||||||
);
|
);
|
||||||
|
|
||||||
if (participant == null)
|
if (participant != null)
|
||||||
{
|
{
|
||||||
participant.IsActive = false;
|
participant.IsActive = false;
|
||||||
await _participantRepository.UpdateAsync(participant, autoSave: true);
|
await _participantRepository.UpdateAsync(participant, autoSave: true);
|
||||||
|
|
|
||||||
|
|
@ -110,16 +110,17 @@ export class SignalRService {
|
||||||
userId: string,
|
userId: string,
|
||||||
userName: string,
|
userName: string,
|
||||||
isTeacher: boolean,
|
isTeacher: boolean,
|
||||||
|
isActive: boolean
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
if (!this.isConnected) {
|
if (!this.isConnected) {
|
||||||
console.log('Error starting SignalR connection join class for', userName)
|
console.log('Error starting SignalR connection join class for', userName)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('Joining class session:', sessionId, 'as', userName, 'isTeacher:', isTeacher)
|
console.log('Joining class session:', sessionId, 'as', userName, 'isTeacher:', isTeacher, 'isActive:', isActive)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await this.connection.invoke('JoinClass', sessionId, userId, userName, isTeacher)
|
await this.connection.invoke('JoinClass', sessionId, userId, userName, isTeacher, isActive)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error joining class:', 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 = () => {
|
const widgets = () => {
|
||||||
return {
|
return {
|
||||||
totalCount: classList.length,
|
totalCount: classList.length,
|
||||||
|
|
|
||||||
|
|
@ -404,6 +404,7 @@ const RoomDetail: React.FC = () => {
|
||||||
user.id,
|
user.id,
|
||||||
user.name,
|
user.name,
|
||||||
user.role === 'teacher',
|
user.role === 'teacher',
|
||||||
|
true
|
||||||
)
|
)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Failed to initialize services:', error)
|
console.error('Failed to initialize services:', error)
|
||||||
|
|
@ -646,6 +647,7 @@ const RoomDetail: React.FC = () => {
|
||||||
studentId,
|
studentId,
|
||||||
randomName,
|
randomName,
|
||||||
false, // öğrenci
|
false, // öğrenci
|
||||||
|
true // aktif
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue