Skip to content

Commit

Permalink
Added url to lms for assignments and discussions
Browse files Browse the repository at this point in the history
  • Loading branch information
allomanta committed Oct 23, 2024
1 parent e531875 commit ef9d97c
Show file tree
Hide file tree
Showing 15 changed files with 131 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const SelectAssignments: FC<SelectAssignmentsProps> = ({ value: entries, onChang
const ass = assignments.get(id);
return {
title: ass ? ass.title : 'No title found',
html_url: ass ? ass.html_url : '',
tile_id: -1, // Set the correct id on the backend
weight: 0,
content_id: id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ const DiscussionSelect: FC<DiscussionSelectProps> = ({
const top = topics.find((disc) => disc.id === id);
return {
title: top ? top.title : 'No title found',
html_url: top ? top.html_url : '',
tile_id: -1, // Set the correct id on the backend
weight: 0,
content_id: id,
Expand Down Expand Up @@ -142,7 +143,7 @@ const DiscussionSelect: FC<DiscussionSelectProps> = ({
/>

<Select
className='w-full [&>div]:!border-accent/70 [&>div]:!bg-surface1 [&>div]:!shadow-none [&>div]:hover:!border-accent [&>div]:hover:!bg-surface2 [&_span]:!text-text'
className='[&>div]:!border-accent/70 [&>div]:!bg-surface1 [&>div]:hover:!border-accent [&>div]:hover:!bg-surface2 [&_span]:!text-text w-full [&>div]:!shadow-none'
dropdownClassName='bg-surface1 [&_div]:!text-text selectionSelected'
value={selectedTopics}
mode='multiple'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ const TileGoalsSelect: FC<TileGoalsSelectProps> = ({ goals, value: entries, onCh
const goal = goals.find((g) => g.id === id);
return {
title: goal ? goal.title : 'No title found',
html_url: '',
tile_id: -1, // Set the correct id on the backend
weight: 0,
content_id: id,
Expand Down Expand Up @@ -124,7 +125,7 @@ const TileGoalsSelect: FC<TileGoalsSelectProps> = ({ goals, value: entries, onCh
/>

<Select
className='w-full [&>div]:!border-accent/70 [&>div]:!bg-surface1 [&>div]:!shadow-none [&>div]:hover:!border-accent [&>div]:hover:!bg-surface2 [&_span]:!text-text'
className='[&>div]:!border-accent/70 [&>div]:!bg-surface1 [&>div]:hover:!border-accent [&>div]:hover:!bg-surface2 [&_span]:!text-text w-full [&>div]:!shadow-none'
dropdownClassName='bg-surface1 [&_div]:!text-text selectionSelected'
value={selectedGoals}
mode='multiple'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,27 +44,19 @@ export const AssignmentDetail: FC<Props> = ({ entry }): ReactElement => {
switch (viewType) {
case 'graph':
return (
<div className='h-full w-full p-2'>
<h3 className='text-text overflow-hidden text-ellipsis text-nowrap text-center font-bold'>{entry.title}</h3>
<div className='grid h-full w-full place-content-center'>
<GraphGrade {...submission.grades} />
</div>
<div className='grid h-5/6 w-full place-content-center'>
<GraphGrade {...submission.grades} />
</div>
);
case 'grid':
return (
<div className='h-full w-full p-2'>
<h3 className='text-text h-1/5 max-w-[270px] overflow-hidden text-ellipsis text-nowrap text-center font-bold'>
{entry.title}
</h3>
<div className='flex h-4/5 w-full flex-col justify-between'>
<div className='grid flex-grow place-content-center'>
<GradeView {...submission.grades} />
</div>
<div>
<Divider className='border-text m-0 p-0' />
<PeerComparison grades={submission.grades} />
</div>
<div className='flex h-4/5 w-full flex-col justify-between'>
<div className='grid flex-grow place-content-center'>
<GradeView {...submission.grades} />
</div>
<div>
<Divider className='border-text m-0 p-0' />
<PeerComparison grades={submission.grades} />
</div>
</div>
);
Expand Down Expand Up @@ -98,25 +90,19 @@ export const DiscussionDetail: FC<Props> = ({ entry }): ReactElement => {
switch (viewType) {
case 'graph':
return (
<div className='h-full w-full p-2'>
<h3 className='text-text overflow-hidden text-ellipsis text-nowrap text-center font-bold'>{entry.title}</h3>
<div className='grid h-full w-full place-content-center'>
<GraphGrade {...discussion.grades} />
</div>
<div className='grid h-full w-full place-content-center'>
<GraphGrade {...discussion.grades} />
</div>
);
case 'grid':
return (
<div className='h-full w-full p-2'>
<h3 className='text-text overflow-hidden text-ellipsis text-nowrap text-center font-bold'>{entry.title}</h3>
<div className='flex h-4/5 w-full flex-col justify-between'>
<div className='grid flex-grow place-content-center'>
<GradeView {...discussion.grades} />
</div>
<div>
<Divider className='border-text m-0 p-0' />
<PeerComparison grades={discussion.grades} />
</div>
<div className='flex h-4/5 w-full flex-col justify-between'>
<div className='grid flex-grow place-content-center'>
<GradeView {...discussion.grades} />
</div>
<div>
<Divider className='border-text m-0 p-0' />
<PeerComparison grades={discussion.grades} />
</div>
</div>
);
Expand Down Expand Up @@ -158,7 +144,6 @@ export const LearningGoalDetail: FC<Props> = ({ entry }): ReactElement => {
return (
<div className='h-full w-full p-2'>
<div className='flex h-1/5 items-baseline justify-between gap-4'>
<h3 className='text-text overflow-hidden text-ellipsis text-nowrap font-bold'>{entry.title}</h3>
{learningGoal.results?.every((b) => b) ?
<span className='text-subtext1 flex place-content-center gap-2 text-sm'>
Passed
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { AssignmentDetail, DiscussionDetail, LearningGoalDetail } from '@/components/atoms/entry-details/entry-details';
import { TileType, type TileEntry } from '@/types/tile';
import { ExportOutlined, QuestionCircleOutlined } from '@ant-design/icons';
import { type FC, type ReactElement } from 'react';

interface Props {
Expand All @@ -8,8 +9,25 @@ interface Props {
}
const EntryView: FC<Props> = ({ entry, type }): ReactElement => {
return (
<div className='h-[230px] w-[270px] max-w-xs rounded-md border border-solid border-border1 bg-surface1'>
{renderViewType()}
<div className='border-border1 bg-surface1 h-[230px] w-[270px] max-w-xs rounded-md border border-solid'>
<div className='h-full w-full'>
<div className='flex h-1/6 w-full place-content-center items-center justify-between px-4 py-2'>
<div>{false && <QuestionCircleOutlined />}</div>
<div className='w-4/6'>
<h3 className='text-text my-auto overflow-hidden text-ellipsis text-nowrap text-center font-bold'>
{entry.title}
</h3>
</div>
<div>
{entry.html_url ?
<a href={entry.html_url} target='_blank' rel='noopener noreferrer'>
<ExportOutlined />
</a>
: ''}
</div>
</div>
{renderViewType()}
</div>
</div>
);

Expand Down
3 changes: 3 additions & 0 deletions IguideME.Web/Frontend/src/types/tile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export enum TileType {
export interface TileEntry {
tile_id: number;
title: string;
html_url: string;
weight: number;
content_id: number;
}
Expand All @@ -53,6 +54,7 @@ export interface Assignment {
id: number;
course_id: number;
title: string;
html_url: string;
published: PublilshedStatus;
muted: boolean;
due_date: number;
Expand All @@ -66,6 +68,7 @@ export interface DiscussionTopic {
course_id: number;
title: string;
author: string;
html_url: string;
date: number;
message: string;
grades?: Grades;
Expand Down
2 changes: 1 addition & 1 deletion IguideME.Web/IguideME.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Npgsql" Version="8.0.3" />
<PackageReference Include="UvA.Connectors.Canvas" Version="0.25.3" />
<PackageReference Include="UvA.Connectors.Canvas" Version="0.25.7" />
<PackageReference Include="StackExchange.Redis" Version="2.2.62" />
<PackageReference Include="System.Data.SQLite" Version="1.0.118" />
<PackageReference Include="UvA.LTI" Version="0.2.0" />
Expand Down
16 changes: 13 additions & 3 deletions IguideME.Web/Models/App/AppAssignment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
namespace IguideME.Web.Models.App
{

public enum PublishStatus {
public enum PublishStatus
{
NotPublished,
LMSPublished,
ExternalData
Expand All @@ -23,6 +24,9 @@ public class AppAssignment
[JsonProperty("external_id")]
public int? ExternalID { get; set; }

[JsonProperty("html_url")]
public string HtmlUrl { get; set; }

[JsonProperty("published")]
public PublishStatus Published { get; set; }

Expand All @@ -43,6 +47,7 @@ public AppAssignment(
int id,
int courseID,
string title,
string url,
int? externalID,
PublishStatus published,
bool muted,
Expand All @@ -59,12 +64,14 @@ public AppAssignment(
this.DueDate = dueDate;
this.MaxGrade = maxGrade;
this.GradingType = gradingType;
this.HtmlUrl = url;
}

public AppAssignment(
int id,
int courseID,
string title,
string url,
int? externalID,
int published,
bool muted,
Expand All @@ -75,8 +82,9 @@ public AppAssignment(
this.ID = id;
this.CourseID = courseID;
this.Title = title;
this.HtmlUrl = url;
this.ExternalID = externalID;
this.Published = (PublishStatus) published;
this.Published = (PublishStatus)published;
this.Muted = muted;
this.DueDate = dueDate;
this.MaxGrade = maxGrade;
Expand All @@ -86,6 +94,7 @@ public AppAssignment(
public AppAssignment(
int courseID,
string title,
string url,
int? externalID,
int published,
bool muted,
Expand All @@ -96,8 +105,9 @@ public AppAssignment(
this.ID = -1;
this.CourseID = courseID;
this.Title = title;
this.HtmlUrl = url;
this.ExternalID = externalID;
this.Published = (PublishStatus) published;
this.Published = (PublishStatus)published;
this.Muted = muted;
this.DueDate = dueDate;
this.MaxGrade = maxGrade;
Expand Down
7 changes: 7 additions & 0 deletions IguideME.Web/Models/App/AppDiscussion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ public class AppDiscussionTopic
[JsonProperty("author")]
public string Author { get; set; }

[JsonProperty("html_url")]
public string HtmlUrl { get; set; }

[JsonProperty("date")]
public long Date { get; set; }

Expand All @@ -40,6 +43,7 @@ public AppDiscussionTopic(
int courseID,
string title,
string author,
string url,
long date,
string message,
IEnumerable<AppDiscussionEntry> entries)
Expand All @@ -48,6 +52,7 @@ public AppDiscussionTopic(
this.CourseID = courseID;
this.Title = title;
this.Author = author;
this.HtmlUrl = url;
this.Date = date;
this.Message = message;
this.Entries = entries;
Expand All @@ -58,6 +63,7 @@ public AppDiscussionTopic(
int courseID,
string title,
string author,
string url,
long date,
string message,
AppGrades grades)
Expand All @@ -66,6 +72,7 @@ public AppDiscussionTopic(
this.CourseID = courseID;
this.Title = title;
this.Author = author;
this.HtmlUrl = url;
this.Date = date;
this.Message = message;
this.Grades = grades;
Expand Down
6 changes: 5 additions & 1 deletion IguideME.Web/Models/Tile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,17 +116,21 @@ public class TileEntry
[JsonProperty(PropertyName = "title")]
public string Title { get; set; }

[JsonProperty(PropertyName = "html_url")]
public string HtmlUrl { get; set; }

[JsonProperty(PropertyName = "content_id")]
public int ContentID { get; set; }

[JsonProperty(PropertyName = "weight")]
public double Weight { get; set; }

public TileEntry(int tileID, int ContentID, string title, double weight)
public TileEntry(int tileID, int ContentID, string title, string url, double weight)
{
this.TileID = tileID;
this.ContentID = ContentID;
this.Title = title;
this.HtmlUrl = url;
this.Weight = weight;
}
}
Expand Down
Loading

0 comments on commit ef9d97c

Please sign in to comment.