mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-25 23:28:33 -06:00
compose
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
|
@using CanvasModel.Enrollments
|
||||||
@using Management.Web.Shared.Components
|
@using Management.Web.Shared.Components
|
||||||
@inject ICanvasService canvas
|
@inject ICanvasService canvas
|
||||||
|
|
||||||
@inject CoursePlanner planner
|
@inject CoursePlanner planner
|
||||||
|
|
||||||
@code
|
@code
|
||||||
@@ -18,6 +20,7 @@
|
|||||||
planner.StateHasChanged -= reload;
|
planner.StateHasChanged -= reload;
|
||||||
}
|
}
|
||||||
private IEnumerable<EnrollmentTermModel>? terms { get; set; } = null;
|
private IEnumerable<EnrollmentTermModel>? terms { get; set; } = null;
|
||||||
|
private IEnumerable<EnrollmentModel>? studentEnrollments { get; set; } = null;
|
||||||
private ulong? _selectedTermId {get; set;}
|
private ulong? _selectedTermId {get; set;}
|
||||||
private ulong? selectedTermId {
|
private ulong? selectedTermId {
|
||||||
get => _selectedTermId;
|
get => _selectedTermId;
|
||||||
@@ -50,10 +53,14 @@
|
|||||||
{
|
{
|
||||||
loading = true;
|
loading = true;
|
||||||
ulong id = planner.LocalCourse?.Settings.CanvasId ?? throw new Exception("wtf how did i get here");
|
ulong id = planner.LocalCourse?.Settings.CanvasId ?? throw new Exception("wtf how did i get here");
|
||||||
|
var enrollmentsTask = canvas.GetEnrolledStudents(id);
|
||||||
var canvasCourse = await canvas.GetCourse(id);
|
var canvasCourse = await canvas.GetCourse(id);
|
||||||
terms = await canvas.GetCurrentTermsFor(canvasCourse.StartAt);
|
terms = await canvas.GetCurrentTermsFor(canvasCourse.StartAt);
|
||||||
|
studentEnrollments = await enrollmentsTask;
|
||||||
|
|
||||||
loading = false;
|
loading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,6 +161,19 @@
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
<AssignmentGroups />
|
<AssignmentGroups />
|
||||||
|
|
||||||
|
@if(studentEnrollments != null)
|
||||||
|
{
|
||||||
|
<div>
|
||||||
|
Students to import to github classroom:
|
||||||
|
@foreach(var enrollment in studentEnrollments)
|
||||||
|
{
|
||||||
|
<div class="ps-3">
|
||||||
|
@(enrollment.User.DisplayName ?? enrollment.User.ShortName)
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
</Body>
|
</Body>
|
||||||
<Footer>
|
<Footer>
|
||||||
<button
|
<button
|
||||||
|
|||||||
@@ -8,26 +8,26 @@ public record GradeModel
|
|||||||
string? HtmlUrl = null,
|
string? HtmlUrl = null,
|
||||||
|
|
||||||
[property: JsonPropertyName("current_grade")]
|
[property: JsonPropertyName("current_grade")]
|
||||||
string? CurrentGrade = null,
|
float? CurrentGrade = null,
|
||||||
|
|
||||||
[property: JsonPropertyName("final_grade")]
|
[property: JsonPropertyName("final_grade")]
|
||||||
string? FinalGrade = null,
|
float? FinalGrade = null,
|
||||||
|
|
||||||
[property: JsonPropertyName("current_score")]
|
[property: JsonPropertyName("current_score")]
|
||||||
string? CurrentScore = null,
|
float? CurrentScore = null,
|
||||||
|
|
||||||
[property: JsonPropertyName("final_score")]
|
[property: JsonPropertyName("final_score")]
|
||||||
string? FinalScore = null,
|
float? FinalScore = null,
|
||||||
|
|
||||||
[property: JsonPropertyName("unposted_current_grade")]
|
[property: JsonPropertyName("unposted_current_grade")]
|
||||||
string? UnpostedCurrentGrade = null,
|
float? UnpostedCurrentGrade = null,
|
||||||
|
|
||||||
[property: JsonPropertyName("unposted_final_grade")]
|
[property: JsonPropertyName("unposted_final_grade")]
|
||||||
string? UnpostedFinalGrade = null,
|
float? UnpostedFinalGrade = null,
|
||||||
|
|
||||||
[property: JsonPropertyName("unposted_current_score")]
|
[property: JsonPropertyName("unposted_current_score")]
|
||||||
string? UnpostedCurrentScore = null,
|
float? UnpostedCurrentScore = null,
|
||||||
|
|
||||||
[property: JsonPropertyName("unposted_final_score")]
|
[property: JsonPropertyName("unposted_final_score")]
|
||||||
string? UnpostedFinalScore = null
|
float? UnpostedFinalScore = null
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
|
using System.Security.Policy;
|
||||||
|
|
||||||
using CanvasModel;
|
using CanvasModel;
|
||||||
using CanvasModel.Assignments;
|
using CanvasModel.Assignments;
|
||||||
using CanvasModel.Courses;
|
using CanvasModel.Courses;
|
||||||
|
using CanvasModel.Enrollments;
|
||||||
using CanvasModel.EnrollmentTerms;
|
using CanvasModel.EnrollmentTerms;
|
||||||
using CanvasModel.Modules;
|
using CanvasModel.Modules;
|
||||||
using CanvasModel.Pages;
|
using CanvasModel.Pages;
|
||||||
@@ -23,6 +26,7 @@ public interface ICanvasService
|
|||||||
Task CreateModuleItem(ulong canvasCourseId, ulong canvasModuleId, string title, string type, ulong contentId);
|
Task CreateModuleItem(ulong canvasCourseId, ulong canvasModuleId, string title, string type, ulong contentId);
|
||||||
Task CreateModuleItem(ulong canvasCourseId, ulong canvasModuleId, string title, string type, string contentId);
|
Task CreateModuleItem(ulong canvasCourseId, ulong canvasModuleId, string title, string type, string contentId);
|
||||||
Task CreatePageModuleItem(ulong canvasCourseId, ulong canvasModuleId, string title, CanvasPage canvasPage);
|
Task CreatePageModuleItem(ulong canvasCourseId, ulong canvasModuleId, string title, CanvasPage canvasPage);
|
||||||
|
Task<IEnumerable<EnrollmentModel>> GetEnrolledStudents(ulong canvasCourseId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CanvasService(
|
public class CanvasService(
|
||||||
@@ -191,4 +195,19 @@ public class CanvasService(
|
|||||||
if (newItem == null)
|
if (newItem == null)
|
||||||
throw new Exception("something went wrong updating module item with string content id");
|
throw new Exception("something went wrong updating module item with string content id");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<EnrollmentModel>> GetEnrolledStudents(
|
||||||
|
ulong canvasCourseId
|
||||||
|
)
|
||||||
|
{
|
||||||
|
logger.Log($"getting students for corse {canvasCourseId}");
|
||||||
|
|
||||||
|
var url = $"courses/{canvasCourseId}/enrollments?enrollment_type=student";
|
||||||
|
var request = new RestRequest(url);
|
||||||
|
var (enrollments, _response) = await webRequestor.GetManyAsync<EnrollmentModel>(request);
|
||||||
|
if (enrollments == null)
|
||||||
|
throw new Exception($"something went wrong getting enrollments for {canvasCourseId}");
|
||||||
|
|
||||||
|
return enrollments;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,21 +10,12 @@ services:
|
|||||||
- storageDirectory=/app/storage
|
- storageDirectory=/app/storage
|
||||||
- TZ=America/Denver
|
- TZ=America/Denver
|
||||||
volumes:
|
volumes:
|
||||||
# - ./storage:/app/storage
|
- ~/projects/faculty/1430/2024-fall-alex/modules:/app/storage/UX
|
||||||
# - ~/projects/faculty/1410/2023-fall-alex/modules:/app/storage/1410
|
- ~/projects/faculty/4850_AdvancedFE/2024-fall-alex/modules:/app/storage/advanced_frontend
|
||||||
- ~/projects/faculty/1810/2024-spring-alex/modules:/app/storage/spring_web
|
- ~/projects/faculty/4850_AdvancedFE/2023-fall-alex/modules:/app/storage/advanced_frontend_2023
|
||||||
- ~/projects/faculty/1810/2024-spring-alex/modules_online:/app/storage/spring_web_online
|
- ~/projects/faculty/1810/2024-fall-alex/modules:/app/storage/intro_to_web
|
||||||
- ~/projects/faculty/1400/2024_spring_alex/modules:/app/storage/spring_1400
|
- ~/projects/faculty/1420/2024-fall/Modules:/app/storage/1420
|
||||||
- ~/projects/faculty/1405/2024_spring_alex/modules:/app/storage/spring_1405
|
- ~/projects/faculty/1425/2024-fall/Modules:/app/storage/1425
|
||||||
- ~/projects/faculty/4620_Distributed/2024Spring/modules:/app/storage/spring_distributed
|
|
||||||
- ~/projects/faculty/3840_Telemetry/2024Spring_alex/modules:/app/storage/spring_telemetry_and_operations
|
|
||||||
|
|
||||||
- ~/projects/faculty/1430/2024-fall-alex/modules:/app/storage/fall_ux
|
|
||||||
- ~/projects/faculty/4850_AdvancedFE/2024-fall-alex/modules:/app/storage/fall_advanced_frontend
|
|
||||||
- ~/projects/faculty/4850_AdvancedFE/2023-fall-alex/modules:/app/storage/fall_advanced_frontend_2023
|
|
||||||
- ~/projects/faculty/1810/2024-fall-alex/modules:/app/storage/fall_intro_to_web
|
|
||||||
- ~/projects/faculty/1420/2024-fall/Modules:/app/storage/fall_1420
|
|
||||||
- ~/projects/faculty/1425/2024-fall/Modules:/app/storage/fall_1425
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -23,9 +23,13 @@ GET https://snow.instructure.com/api/v1/courses/855351/modules
|
|||||||
Authorization: Bearer {{$dotenv CANVAS_TOKEN}}
|
Authorization: Bearer {{$dotenv CANVAS_TOKEN}}
|
||||||
###
|
###
|
||||||
|
|
||||||
GET https://snow.instructure.com/api/v1/courses/871954/modules
|
GET https://snow.instructure.com/api/v1/courses/871954
|
||||||
Authorization: Bearer {{$dotenv CANVAS_TOKEN}}
|
Authorization: Bearer {{$dotenv CANVAS_TOKEN}}
|
||||||
|
|
||||||
###
|
###
|
||||||
GET https://snow.instructure.com/api/v1/courses/871954/modules/2972989/items
|
GET https://snow.instructure.com/api/v1/courses/871954/modules/2972989/items
|
||||||
Authorization: Bearer {{$dotenv CANVAS_TOKEN}}
|
Authorization: Bearer {{$dotenv CANVAS_TOKEN}}
|
||||||
|
|
||||||
|
###
|
||||||
|
GET https://snow.instructure.com/api/v1/courses/960410/users?enrollment_type=student
|
||||||
|
Authorization: Bearer {{$dotenv CANVAS_TOKEN}}
|
||||||
|
|||||||
Reference in New Issue
Block a user