Skip to content
This repository has been archived by the owner on Sep 4, 2023. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Typiqally/epsilon
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.0.0-beta2
Choose a base ref
...
head repository: Typiqally/epsilon
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.0.0-beta3
Choose a head ref
  • 2 commits
  • 9 files changed
  • 2 contributors

Commits on Jun 21, 2022

  1. Update README.md

    Typiqally authored Jun 21, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    f59b29d View commit details

Commits on Jun 29, 2022

  1. Release v1.0.0-beta3 (#32)

    * Change formats type to `string` and split with comma separator
    
    * Use root configuration instead of configuration section
    
    * Fix exceptions not properly displaying in the console
    
    * Add all module item types according to documentation
    
    * Update application demo GIF
    
    * Create code-analysis.yml
    
    * Remove comments and enable additional queries
    
    * Removed push from code-analysis.yml workflow
    
    * Typo code-analysis.yml
    
    Co-authored-by: Neal Geilen <info@nealgeilen.nl>
    Typiqally and NealGeilen authored Jun 29, 2022
    Copy the full SHA
    e48a659 View commit details
37 changes: 37 additions & 0 deletions .github/workflows/code-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: "Code analysis"

on:
pull_request:
branches: [ "master", "develop" ]
schedule:
- cron: '22 18 * * 5'

jobs:
analyze:
name: Analyze code
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'csharp' ]

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
queries: security-extended,security-and-quality

- name: Autobuild
uses: github/codeql-action/autobuild@v2

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
3 changes: 1 addition & 2 deletions Epsilon.Canvas.Abstractions/Model/ModuleItem.cs
Original file line number Diff line number Diff line change
@@ -5,7 +5,6 @@ namespace Epsilon.Canvas.Abstractions.Model;
public record ModuleItem(
[property: JsonPropertyName("id")] int Id,
[property: JsonPropertyName("title")] string Title,
[property: JsonPropertyName("type"), JsonConverter(typeof(JsonStringEnumConverter))]
ModuleItemType? Type,
[property: JsonPropertyName("type")] ModuleItemType? Type,
[property: JsonPropertyName("content_id")] int? ContentId
);
12 changes: 9 additions & 3 deletions Epsilon.Canvas.Abstractions/Model/ModuleItemType.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
namespace Epsilon.Canvas.Abstractions.Model;
using System.Text.Json.Serialization;

namespace Epsilon.Canvas.Abstractions.Model;

[JsonConverter(typeof(JsonStringEnumConverter))]
public enum ModuleItemType
{
Unknown,
File,
Page,
Discussion,
Assignment,
Quiz,
SubHeader,
File,
ExternalUrl,
ExternalTool,
}
21 changes: 17 additions & 4 deletions Epsilon.Cli/Program.cs
Original file line number Diff line number Diff line change
@@ -25,7 +25,20 @@ IHostBuilder CreateHostBuilder(string[] args)
});
}

await CreateHostBuilder(args)
.UseSerilog()
.Build()
.RunAsync();
try
{
Log.Information("Starting up");

await CreateHostBuilder(args)
.UseSerilog()
.Build()
.RunAsync();
}
catch (Exception ex)
{
Log.Fatal(ex, "Application was unable to start due to fatal error");
}
finally
{
Log.CloseAndFlush();
}
43 changes: 27 additions & 16 deletions Epsilon.Cli/Startup.cs
Original file line number Diff line number Diff line change
@@ -48,31 +48,42 @@ public Task StopAsync(CancellationToken cancellationToken)

private async Task ExecuteAsync()
{
var results = Validate(_canvasSettings).ToArray();
if (results.Any())
try
{
foreach (var validationResult in results)
var results = Validate(_canvasSettings).ToArray();
if (results.Any())
{
_logger.LogError("Error: {Message}", validationResult.ErrorMessage);
foreach (var validationResult in results)
{
_logger.LogError("Error: {Message}", validationResult.ErrorMessage);
}

_lifetime.StopApplication();
return;
}

_lifetime.StopApplication();
return;
}
_logger.LogInformation("Targeting Canvas course: {CourseId}, at {Url}", _canvasSettings.CourseId, _canvasSettings.ApiUrl);
var modules = await _collectionFetcher.GetAll(_canvasSettings.CourseId);

_logger.LogInformation("Targeting Canvas course: {CourseId}, at {Url}", _canvasSettings.CourseId, _canvasSettings.ApiUrl);
var modules = await _collectionFetcher.GetAll(_canvasSettings.CourseId);
var formats = _exportOptions.Formats.Split(",");
var exporters = _exporterCollection.DetermineExporters(formats).ToArray();

_logger.LogInformation("Attempting to use following formats: {Formats}", string.Join(", ", _exportOptions.Formats));
var exporters = _exporterCollection.DetermineExporters(_exportOptions.Formats).ToArray();
_logger.LogInformation("Attempting to use following formats: {Formats}", string.Join(", ", formats));

foreach (var (format, exporter) in exporters)
foreach (var (format, exporter) in exporters)
{
_logger.LogInformation("Exporting to {Format} using {Exporter}...", format, exporter.GetType().Name);
exporter.Export(modules, format);
}
}
catch (Exception ex)
{
_logger.LogInformation("Exporting to {Format} using {Exporter}...", format, exporter.GetType().Name);
exporter.Export(modules, format);
_logger.LogError(ex, "Error occured:");
}
finally
{
_lifetime.StopApplication();
}

_lifetime.StopApplication();
}

private static IEnumerable<ValidationResult> Validate(object model)
13 changes: 1 addition & 12 deletions Epsilon.Cli/appsettings.example.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
{
"Logging": {
"LogLevel": {
"Default": "Debug",
"System": "None",
"Microsoft": "None"
}
},
"Serilog": {
"Using": [
"Serilog.Sinks.Console"
],
"MinimumLevel": {
"Default": "Debug",
"Override": {
"Microsoft": "Error",
"System": "Error"
}
"Default": "Debug"
},
"WriteTo": [
{
2 changes: 1 addition & 1 deletion Epsilon/Export/ExportOptions.cs
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ public class ExportOptions
{
public string OutputName { get; set; } = "Epsilon-Export-{DateTime}";

public List<string> Formats { get; } = new();
public string Formats { get; set; } = "console";

public string FormattedOutputName => OutputName
.Replace("{DateTime}", DateTime.Now.ToString("ddMMyyyyHHmmss"));
2 changes: 1 addition & 1 deletion Epsilon/Extensions/CoreServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ public static class CoreServiceCollectionExtensions
public static IServiceCollection AddCore(this IServiceCollection services, IConfiguration config)
{
services.AddCanvas(config.GetSection("Canvas"));
services.AddExport(config.GetSection("Export"));
services.AddExport(config);

return services;
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ These students usually have a personal course within Canvas (from Instructure),
During each semester, it is requested to take note of all KPI's which have been proven.
To aid in these efforts, this application will gather all your mastered/proven [KPI's](https://hbo-i.nl/domeinbeschrijving/) and export your KPI's to a file format (e.g., JSON, Exel, CSV).

![Application demo](https://i.imgur.com/JYWmtVQ.gif)
![Application demo](https://user-images.githubusercontent.com/12190745/176268592-e863e4c3-47b4-4af5-aeca-298d53a37c33.gif)

## Usage
Read how to use the application in our Wiki located [here](https://github.com/Typiqally/epsilon/wiki/How-to-use).