From a7cab396aa087c7437125be173566e4c71457d71 Mon Sep 17 00:00:00 2001 From: Pufke Date: Tue, 16 Mar 2021 18:16:24 +0100 Subject: [PATCH 01/14] refactor: deleted redudant comment --- Clean CaDET/Model/PlatformConnection/CaDETConnection.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Clean CaDET/Model/PlatformConnection/CaDETConnection.cs b/Clean CaDET/Model/PlatformConnection/CaDETConnection.cs index ac28a7b..5376a83 100644 --- a/Clean CaDET/Model/PlatformConnection/CaDETConnection.cs +++ b/Clean CaDET/Model/PlatformConnection/CaDETConnection.cs @@ -17,6 +17,8 @@ public async Task GetClassQualityAnalysisAsync(str StringContent request = new StringContent(JsonConvert.SerializeObject(sourceCode), Encoding.UTF8, "application/json"); HttpResponseMessage response = await _httpClient.PostAsync(codeUrl, request); string content = await response.Content.ReadAsStringAsync(); + //TODO: Delete this print + System.Diagnostics.Debug.WriteLine(content); return JsonConvert.DeserializeObject(content); } } From 3a6af54c411c2f87e4be9ca5a19a0ffbee949ce5 Mon Sep 17 00:00:00 2001 From: Pufke Date: Wed, 17 Mar 2021 00:59:28 +0100 Subject: [PATCH 02/14] feature: first API Enpoint from plugin to SmartTutor --- .../PlatformConnection/CaDETConnection.cs | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/Clean CaDET/Model/PlatformConnection/CaDETConnection.cs b/Clean CaDET/Model/PlatformConnection/CaDETConnection.cs index 5376a83..89aa8e0 100644 --- a/Clean CaDET/Model/PlatformConnection/CaDETConnection.cs +++ b/Clean CaDET/Model/PlatformConnection/CaDETConnection.cs @@ -10,16 +10,22 @@ public sealed class CaDETConnection: IPlatformConnection { private readonly HttpClient _httpClient = new HttpClient(); //TODO:Refactor to be read from configuration - private readonly string codeUrl = "https://localhost:44325/api/repository/education/class"; + private readonly string codeUrlRepositoryCompiler = "https://localhost:44325/api/repository/education/class"; + private readonly string codeUrlSmartTutor = "https://localhost:44333/api/smarttutor/education/class"; public async Task GetClassQualityAnalysisAsync(string sourceCode) { - StringContent request = new StringContent(JsonConvert.SerializeObject(sourceCode), Encoding.UTF8, "application/json"); - HttpResponseMessage response = await _httpClient.PostAsync(codeUrl, request); - string content = await response.Content.ReadAsStringAsync(); - //TODO: Delete this print - System.Diagnostics.Debug.WriteLine(content); - return JsonConvert.DeserializeObject(content); + StringContent requestRepositoryCompiler = new StringContent(JsonConvert.SerializeObject(sourceCode), Encoding.UTF8, "application/json"); + HttpResponseMessage responseRepositoryCompiler = await _httpClient.PostAsync(codeUrlRepositoryCompiler, requestRepositoryCompiler); + string contentRepositoryCompiler = await responseRepositoryCompiler.Content.ReadAsStringAsync(); + + StringContent requestSmartTutor = new StringContent(JsonConvert.SerializeObject(sourceCode), Encoding.UTF8, "application/json"); + HttpResponseMessage responseSmartTutor = await _httpClient.PostAsync(codeUrlSmartTutor, requestSmartTutor); + string contentSmartTutor = await responseSmartTutor.Content.ReadAsStringAsync(); + + return JsonConvert.DeserializeObject(contentRepositoryCompiler); } + + } } \ No newline at end of file From e10abd294f9af69b2b32624527098826cc66b66a Mon Sep 17 00:00:00 2001 From: vlaksi Date: Wed, 17 Mar 2021 01:48:31 +0100 Subject: [PATCH 03/14] feat: prepare to receive content from smart tutor & inital show of that content --- Clean CaDET/Clean CaDET.csproj | 4 ++ .../DTOs/NewEducationContentDTO.cs | 16 ++++++++ .../DTOs/NewEducationSnippetDTO.cs | 17 ++++++++ .../PlatformConnection/DTOs/SnippetType.cs | 12 ++++++ .../Model/PlatformConnection/DTOs/Tag.cs | 9 +++++ Clean CaDET/View/TutoringWindowControl.xaml | 38 ++++++++++++++++++ .../View/TutoringWindowControl.xaml.cs | 39 ++++++++++++++++++- .../View/ViewModel/TutoringWindowVM.cs | 19 +++++++-- 8 files changed, 148 insertions(+), 6 deletions(-) create mode 100644 Clean CaDET/Model/PlatformConnection/DTOs/NewEducationContentDTO.cs create mode 100644 Clean CaDET/Model/PlatformConnection/DTOs/NewEducationSnippetDTO.cs create mode 100644 Clean CaDET/Model/PlatformConnection/DTOs/SnippetType.cs create mode 100644 Clean CaDET/Model/PlatformConnection/DTOs/Tag.cs diff --git a/Clean CaDET/Clean CaDET.csproj b/Clean CaDET/Clean CaDET.csproj index ebae09a..c5d3177 100644 --- a/Clean CaDET/Clean CaDET.csproj +++ b/Clean CaDET/Clean CaDET.csproj @@ -47,6 +47,10 @@ 8.0 + + + + diff --git a/Clean CaDET/Model/PlatformConnection/DTOs/NewEducationContentDTO.cs b/Clean CaDET/Model/PlatformConnection/DTOs/NewEducationContentDTO.cs new file mode 100644 index 0000000..41149c2 --- /dev/null +++ b/Clean CaDET/Model/PlatformConnection/DTOs/NewEducationContentDTO.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Clean_CaDET.Model.PlatformConnection.DTOs +{ + public class NewEducationContentDTO + { + public int ContentQuality { get; set; } + public int ContentDifficulty { get; set; } + public ObservableCollection EducationSnippets { get; set; } + } +} \ No newline at end of file diff --git a/Clean CaDET/Model/PlatformConnection/DTOs/NewEducationSnippetDTO.cs b/Clean CaDET/Model/PlatformConnection/DTOs/NewEducationSnippetDTO.cs new file mode 100644 index 0000000..2ac5769 --- /dev/null +++ b/Clean CaDET/Model/PlatformConnection/DTOs/NewEducationSnippetDTO.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Clean_CaDET.Model.PlatformConnection.DTOs +{ + public class NewEducationSnippetDTO + { + public int SnippetQuality { get; set; } + public int SnippetDifficulty { get; set; } + public SnippetType SnippetType { get; set; } + public List Tags { get; set; } + public string Content { get; set; } + } +} \ No newline at end of file diff --git a/Clean CaDET/Model/PlatformConnection/DTOs/SnippetType.cs b/Clean CaDET/Model/PlatformConnection/DTOs/SnippetType.cs new file mode 100644 index 0000000..faa1f67 --- /dev/null +++ b/Clean CaDET/Model/PlatformConnection/DTOs/SnippetType.cs @@ -0,0 +1,12 @@ +namespace Clean_CaDET.Model.PlatformConnection.DTOs +{ + public enum SnippetType + { + CodeSnippet, + LongText, + ShortText, + Video, + Image, + Diagram + } +} \ No newline at end of file diff --git a/Clean CaDET/Model/PlatformConnection/DTOs/Tag.cs b/Clean CaDET/Model/PlatformConnection/DTOs/Tag.cs new file mode 100644 index 0000000..adfcf09 --- /dev/null +++ b/Clean CaDET/Model/PlatformConnection/DTOs/Tag.cs @@ -0,0 +1,9 @@ +namespace Clean_CaDET.Model.PlatformConnection.DTOs +{ + public enum Tag + { + Funny, + MustKnow, + Interesting + } +} \ No newline at end of file diff --git a/Clean CaDET/View/TutoringWindowControl.xaml b/Clean CaDET/View/TutoringWindowControl.xaml index a2feef3..1a8ec28 100644 --- a/Clean CaDET/View/TutoringWindowControl.xaml +++ b/Clean CaDET/View/TutoringWindowControl.xaml @@ -37,6 +37,44 @@ + + + + + + + + + + + + + + + + + diff --git a/Clean CaDET/View/TutoringWindowControl.xaml.cs b/Clean CaDET/View/TutoringWindowControl.xaml.cs index 2da686f..a08d6e8 100644 --- a/Clean CaDET/View/TutoringWindowControl.xaml.cs +++ b/Clean CaDET/View/TutoringWindowControl.xaml.cs @@ -1,4 +1,6 @@ -using Clean_CaDET.Model; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using Clean_CaDET.Model; using Clean_CaDET.View.ViewModel; using System.Windows; using System.Windows.Controls; @@ -27,7 +29,40 @@ public TutoringWindowControl() "Our analysis shows that this class has low cohesion. This signals that there might be two or more concepts represented by this class. Looking at the figure, we see how the class can be split into three classes, each containing a method and related field. Importantly, we presume the methods are not accessors (getters and setters).", Recommendations = "See if you can split the class by grouping the fields (or their subset) with methods that utilize them. If you can find suitable names for the two groups than you should perform the Extract Class refactoring. If one group is hard to define and sufficiently large, this might mean you have even more classes to extract." - } + }, + NewContent = new NewEducationContentDTO() + { + ContentDifficulty = 4, + ContentQuality = 3, + EducationSnippets = new ObservableCollection() + { + new NewEducationSnippetDTO() + { + SnippetType = SnippetType.ShortText, + Content = "Some short text", + SnippetDifficulty = 3, + SnippetQuality = 2, + Tags = new List() + { + Model.PlatformConnection.DTOs.Tag.Funny, + Model.PlatformConnection.DTOs.Tag.Interesting + } + }, + new NewEducationSnippetDTO() + { + SnippetType = SnippetType.ShortText, + Content = "Some must know short text", + SnippetDifficulty = 5, + SnippetQuality = 5, + Tags = new List() + { + Model.PlatformConnection.DTOs.Tag.MustKnow + } + } + } + } + + }; DataContext = ViewModel; diff --git a/Clean CaDET/View/ViewModel/TutoringWindowVM.cs b/Clean CaDET/View/ViewModel/TutoringWindowVM.cs index c627629..fb73cbc 100644 --- a/Clean CaDET/View/ViewModel/TutoringWindowVM.cs +++ b/Clean CaDET/View/ViewModel/TutoringWindowVM.cs @@ -3,11 +3,24 @@ namespace Clean_CaDET.View.ViewModel { - public class TutoringWindowVM: INotifyPropertyChanged + public class TutoringWindowVM : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; //TODO: Should create a ViewModel class eventually, for basic examples this will suffice. private EducationalContentDTO _content; + private ClassMetricsDTO _metrics; + private NewEducationContentDTO _newContent; + + public NewEducationContentDTO NewContent + { + get => _newContent; + set + { + _newContent = value; + OnPropertyChanged("NewContent"); + } + } + public EducationalContentDTO Content { get => _content; @@ -18,8 +31,6 @@ public EducationalContentDTO Content } } - private ClassMetricsDTO _metrics; - public ClassMetricsDTO Metrics { get => _metrics; @@ -35,4 +46,4 @@ private void OnPropertyChanged(string propertyName) PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } } -} +} \ No newline at end of file From 96f2b6773c3614dfab3e97f770bff71ff539b134 Mon Sep 17 00:00:00 2001 From: vlaksi Date: Wed, 17 Mar 2021 02:40:22 +0100 Subject: [PATCH 04/14] refactor: removed data grid and added items control --- Clean CaDET/View/TutoringWindowControl.xaml | 39 +++++++++++---------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/Clean CaDET/View/TutoringWindowControl.xaml b/Clean CaDET/View/TutoringWindowControl.xaml index 1a8ec28..58cb664 100644 --- a/Clean CaDET/View/TutoringWindowControl.xaml +++ b/Clean CaDET/View/TutoringWindowControl.xaml @@ -52,27 +52,28 @@ Style="{StaticResource TextContentStyle}" Margin="40 10 10 10" /> - - + + + + + + from data template + + + + + + + + + + - - - - - - From 570f71c926573da4a542aa80c3b002d9fe654dba Mon Sep 17 00:00:00 2001 From: vlaksi Date: Wed, 17 Mar 2021 03:32:08 +0100 Subject: [PATCH 05/14] feat: added base structure for preview of education content --- Clean CaDET/View/TutoringWindowControl.xaml | 93 +++++++++++++-------- 1 file changed, 57 insertions(+), 36 deletions(-) diff --git a/Clean CaDET/View/TutoringWindowControl.xaml b/Clean CaDET/View/TutoringWindowControl.xaml index 58cb664..bace1e7 100644 --- a/Clean CaDET/View/TutoringWindowControl.xaml +++ b/Clean CaDET/View/TutoringWindowControl.xaml @@ -32,47 +32,68 @@ - - - - - - - - - - + - - - + + + + + + + + + - from data template - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From dd0784295576fe5f2f66811d2036e632f24bead8 Mon Sep 17 00:00:00 2001 From: vlaksi Date: Wed, 17 Mar 2021 20:33:00 +0100 Subject: [PATCH 06/14] feat: add more structured wpf design --- Clean CaDET/View/TutoringWindowControl.xaml | 45 +++++++++++++++---- .../View/TutoringWindowControl.xaml.cs | 4 +- 2 files changed, 38 insertions(+), 11 deletions(-) diff --git a/Clean CaDET/View/TutoringWindowControl.xaml b/Clean CaDET/View/TutoringWindowControl.xaml index bace1e7..818e792 100644 --- a/Clean CaDET/View/TutoringWindowControl.xaml +++ b/Clean CaDET/View/TutoringWindowControl.xaml @@ -48,8 +48,6 @@ - - - + - + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Clean CaDET/View/TutoringWindowControl.xaml.cs b/Clean CaDET/View/TutoringWindowControl.xaml.cs index a08d6e8..91a7d3e 100644 --- a/Clean CaDET/View/TutoringWindowControl.xaml.cs +++ b/Clean CaDET/View/TutoringWindowControl.xaml.cs @@ -50,8 +50,8 @@ public TutoringWindowControl() }, new NewEducationSnippetDTO() { - SnippetType = SnippetType.ShortText, - Content = "Some must know short text", + SnippetType = SnippetType.LongText, + Content = "Some must know long text", SnippetDifficulty = 5, SnippetQuality = 5, Tags = new List() From d8b12643b60be8d7fe0002dc6070c6ed3db9d761 Mon Sep 17 00:00:00 2001 From: vlaksi Date: Wed, 17 Mar 2021 21:59:36 +0100 Subject: [PATCH 07/14] feat: enabled receive educational content from smart tutor --- Clean CaDET/Model/PlatformConnection/CaDETConnection.cs | 8 ++++---- .../DTOs/ClassQualityAnalysisResponse.cs | 8 +++++--- Clean CaDET/View/Commands/ExamineProjectItemCommand.cs | 2 +- Clean CaDET/View/TutoringWindow.cs | 5 ++--- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Clean CaDET/Model/PlatformConnection/CaDETConnection.cs b/Clean CaDET/Model/PlatformConnection/CaDETConnection.cs index 89aa8e0..2633a97 100644 --- a/Clean CaDET/Model/PlatformConnection/CaDETConnection.cs +++ b/Clean CaDET/Model/PlatformConnection/CaDETConnection.cs @@ -15,15 +15,15 @@ public sealed class CaDETConnection: IPlatformConnection public async Task GetClassQualityAnalysisAsync(string sourceCode) { - StringContent requestRepositoryCompiler = new StringContent(JsonConvert.SerializeObject(sourceCode), Encoding.UTF8, "application/json"); - HttpResponseMessage responseRepositoryCompiler = await _httpClient.PostAsync(codeUrlRepositoryCompiler, requestRepositoryCompiler); - string contentRepositoryCompiler = await responseRepositoryCompiler.Content.ReadAsStringAsync(); + //StringContent requestRepositoryCompiler = new StringContent(JsonConvert.SerializeObject(sourceCode), Encoding.UTF8, "application/json"); + //HttpResponseMessage responseRepositoryCompiler = await _httpClient.PostAsync(codeUrlRepositoryCompiler, requestRepositoryCompiler); + //string contentRepositoryCompiler = await responseRepositoryCompiler.Content.ReadAsStringAsync(); StringContent requestSmartTutor = new StringContent(JsonConvert.SerializeObject(sourceCode), Encoding.UTF8, "application/json"); HttpResponseMessage responseSmartTutor = await _httpClient.PostAsync(codeUrlSmartTutor, requestSmartTutor); string contentSmartTutor = await responseSmartTutor.Content.ReadAsStringAsync(); - return JsonConvert.DeserializeObject(contentRepositoryCompiler); + return JsonConvert.DeserializeObject(contentSmartTutor); } diff --git a/Clean CaDET/Model/PlatformConnection/DTOs/ClassQualityAnalysisResponse.cs b/Clean CaDET/Model/PlatformConnection/DTOs/ClassQualityAnalysisResponse.cs index 4b494be..e0c6681 100644 --- a/Clean CaDET/Model/PlatformConnection/DTOs/ClassQualityAnalysisResponse.cs +++ b/Clean CaDET/Model/PlatformConnection/DTOs/ClassQualityAnalysisResponse.cs @@ -1,8 +1,10 @@ -namespace Clean_CaDET.Model.PlatformConnection.DTOs +using System; + +namespace Clean_CaDET.Model.PlatformConnection.DTOs { public class ClassQualityAnalysisResponse { - public ClassMetricsDTO Metrics { get; set; } - public EducationalContentDTO Content { get; set; } + public Guid Id { get; set; } + public NewEducationContentDTO NewContent { get; set; } } } diff --git a/Clean CaDET/View/Commands/ExamineProjectItemCommand.cs b/Clean CaDET/View/Commands/ExamineProjectItemCommand.cs index 9d54f89..30a1c28 100644 --- a/Clean CaDET/View/Commands/ExamineProjectItemCommand.cs +++ b/Clean CaDET/View/Commands/ExamineProjectItemCommand.cs @@ -137,7 +137,7 @@ private async void Execute(object sender, EventArgs e) } var tutoringWindow = window as TutoringWindow; - tutoringWindow?.UpdateVMContent(codeQualityAnalysis.Content, codeQualityAnalysis.Metrics); + tutoringWindow?.UpdateVMContent(codeQualityAnalysis.NewContent); IVsWindowFrame windowFrame = (IVsWindowFrame)window.Frame; ErrorHandler.ThrowOnFailure(windowFrame.Show()); diff --git a/Clean CaDET/View/TutoringWindow.cs b/Clean CaDET/View/TutoringWindow.cs index ad8fb12..39cd90b 100644 --- a/Clean CaDET/View/TutoringWindow.cs +++ b/Clean CaDET/View/TutoringWindow.cs @@ -13,11 +13,10 @@ public TutoringWindow() : base(null) Content = new TutoringWindowControl(); } - public void UpdateVMContent(EducationalContentDTO content, ClassMetricsDTO metrics) + public void UpdateVMContent(NewEducationContentDTO newEducationContent) { var windowControl = Content as TutoringWindowControl; - windowControl.ViewModel.Content = content; - windowControl.ViewModel.Metrics = metrics; + windowControl.ViewModel.NewContent = newEducationContent; } } } From e52d5c6cdbdd59741eeb9bf1d42c4880a8e165cd Mon Sep 17 00:00:00 2001 From: vlaksi Date: Fri, 19 Mar 2021 17:22:33 +0100 Subject: [PATCH 08/14] feat: added new color design for page & added text wraping --- Clean CaDET/View/TutoringWindowControl.xaml | 31 ++++++++------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/Clean CaDET/View/TutoringWindowControl.xaml b/Clean CaDET/View/TutoringWindowControl.xaml index 818e792..444a525 100644 --- a/Clean CaDET/View/TutoringWindowControl.xaml +++ b/Clean CaDET/View/TutoringWindowControl.xaml @@ -29,36 +29,29 @@ - + - + - + - - + + - - + - + @@ -68,9 +61,9 @@ - + - + @@ -94,9 +87,9 @@ - + - + From 25e7de880d40fbbce1b77f5091b0431f84bc578d Mon Sep 17 00:00:00 2001 From: Pufke Date: Fri, 19 Mar 2021 18:05:19 +0100 Subject: [PATCH 09/14] feat: communication SmartTutor and RepositoryCompiler with Platform --- .../PlatformConnection/CaDETConnection.cs | 32 ++++++++++++++----- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/Clean CaDET/Model/PlatformConnection/CaDETConnection.cs b/Clean CaDET/Model/PlatformConnection/CaDETConnection.cs index 2633a97..9ac4042 100644 --- a/Clean CaDET/Model/PlatformConnection/CaDETConnection.cs +++ b/Clean CaDET/Model/PlatformConnection/CaDETConnection.cs @@ -1,4 +1,5 @@ -using System.Net.Http; +using System; +using System.Net.Http; using System.Text; using System.Threading.Tasks; using Clean_CaDET.Model.PlatformConnection.DTOs; @@ -15,17 +16,32 @@ public sealed class CaDETConnection: IPlatformConnection public async Task GetClassQualityAnalysisAsync(string sourceCode) { - //StringContent requestRepositoryCompiler = new StringContent(JsonConvert.SerializeObject(sourceCode), Encoding.UTF8, "application/json"); - //HttpResponseMessage responseRepositoryCompiler = await _httpClient.PostAsync(codeUrlRepositoryCompiler, requestRepositoryCompiler); - //string contentRepositoryCompiler = await responseRepositoryCompiler.Content.ReadAsStringAsync(); + StringContent requestRepositoryCompiler = new StringContent(JsonConvert.SerializeObject(sourceCode), Encoding.UTF8, "application/json"); + HttpResponseMessage responseRepositoryCompiler = await _httpClient.PostAsync(codeUrlRepositoryCompiler, requestRepositoryCompiler); + string contentRepositoryCompiler = await responseRepositoryCompiler.Content.ReadAsStringAsync(); - StringContent requestSmartTutor = new StringContent(JsonConvert.SerializeObject(sourceCode), Encoding.UTF8, "application/json"); - HttpResponseMessage responseSmartTutor = await _httpClient.PostAsync(codeUrlSmartTutor, requestSmartTutor); - string contentSmartTutor = await responseSmartTutor.Content.ReadAsStringAsync(); + ClassQualityAnalysisResponse repositoryCompilerResponse = JsonConvert.DeserializeObject(contentRepositoryCompiler); + + var bytes = new Byte[16]; + var EmptyGuid = new Guid(bytes); + + ClassQualityAnalysisResponse analysis = await SendRequestToSmartTutor(repositoryCompilerResponse); - return JsonConvert.DeserializeObject(contentSmartTutor); + while (analysis.Id.Equals(EmptyGuid)) + { // TODO: Check edge case when we do not have a issue and content for developer + analysis = await SendRequestToSmartTutor(repositoryCompilerResponse); + } + return analysis; } + private async Task SendRequestToSmartTutor(ClassQualityAnalysisResponse repositoryCompilerResponse) + { + StringContent requestSmartTutor = new StringContent(JsonConvert.SerializeObject(repositoryCompilerResponse.Id), Encoding.UTF8, "application/json"); + HttpResponseMessage responseSmartTutor = await _httpClient.PostAsync(codeUrlSmartTutor, requestSmartTutor); + string contentSmartTutor = await responseSmartTutor.Content.ReadAsStringAsync(); + var analysis = JsonConvert.DeserializeObject(contentSmartTutor); + return analysis; + } } } \ No newline at end of file From ce5e821f1b664eb832d403f6cf97471428a0bac9 Mon Sep 17 00:00:00 2001 From: Pufke Date: Fri, 19 Mar 2021 20:46:33 +0100 Subject: [PATCH 10/14] feat: display image from URL --- Clean CaDET/View/TutoringWindowControl.xaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Clean CaDET/View/TutoringWindowControl.xaml b/Clean CaDET/View/TutoringWindowControl.xaml index 444a525..91c9662 100644 --- a/Clean CaDET/View/TutoringWindowControl.xaml +++ b/Clean CaDET/View/TutoringWindowControl.xaml @@ -66,6 +66,7 @@ + From 8829d2fff6f6667efea7bee5f50d032606dde3ba Mon Sep 17 00:00:00 2001 From: Pufke Date: Sat, 20 Mar 2021 00:06:01 +0100 Subject: [PATCH 11/14] feat: display image on plugin educational content --- Clean CaDET/View/TutoringWindowControl.xaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Clean CaDET/View/TutoringWindowControl.xaml b/Clean CaDET/View/TutoringWindowControl.xaml index 91c9662..d50508b 100644 --- a/Clean CaDET/View/TutoringWindowControl.xaml +++ b/Clean CaDET/View/TutoringWindowControl.xaml @@ -62,11 +62,11 @@ - + - + + - From f59e6ee84c9b1d393dac9c7521adcee46cdb845d Mon Sep 17 00:00:00 2001 From: vlaksi Date: Sat, 20 Mar 2021 00:54:14 +0100 Subject: [PATCH 12/14] feat: selectable text in card & margin of content in card --- Clean CaDET/View/TutoringWindowControl.xaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Clean CaDET/View/TutoringWindowControl.xaml b/Clean CaDET/View/TutoringWindowControl.xaml index d50508b..f7a18cb 100644 --- a/Clean CaDET/View/TutoringWindowControl.xaml +++ b/Clean CaDET/View/TutoringWindowControl.xaml @@ -62,8 +62,9 @@ - - + + + From 608e62eae37bc71bbf3ce738bdb8afd8728581af Mon Sep 17 00:00:00 2001 From: Pufke Date: Fri, 2 Apr 2021 18:02:48 +0200 Subject: [PATCH 13/14] test: Stress testing purpose logic --- .../PlatformConnection/CaDETConnection.cs | 33 +++++++++++++++++-- .../Commands/ExamineProjectItemCommand.cs | 23 +++++++------ 2 files changed, 43 insertions(+), 13 deletions(-) diff --git a/Clean CaDET/Model/PlatformConnection/CaDETConnection.cs b/Clean CaDET/Model/PlatformConnection/CaDETConnection.cs index 9ac4042..c242950 100644 --- a/Clean CaDET/Model/PlatformConnection/CaDETConnection.cs +++ b/Clean CaDET/Model/PlatformConnection/CaDETConnection.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Net.Http; using System.Text; using System.Threading.Tasks; @@ -7,13 +8,17 @@ namespace Clean_CaDET.Model.PlatformConnection { - public sealed class CaDETConnection: IPlatformConnection + public sealed class CaDETConnection : IPlatformConnection { private readonly HttpClient _httpClient = new HttpClient(); //TODO:Refactor to be read from configuration private readonly string codeUrlRepositoryCompiler = "https://localhost:44325/api/repository/education/class"; private readonly string codeUrlSmartTutor = "https://localhost:44333/api/smarttutor/education/class"; + //TODO: Delete this two Lists and Logic about them in this method, only testing purposes + List sentRequests = new List(); + List recivedRequests = new List(); + public async Task GetClassQualityAnalysisAsync(string sourceCode) { StringContent requestRepositoryCompiler = new StringContent(JsonConvert.SerializeObject(sourceCode), Encoding.UTF8, "application/json"); @@ -27,10 +32,32 @@ public async Task GetClassQualityAnalysisAsync(str ClassQualityAnalysisResponse analysis = await SendRequestToSmartTutor(repositoryCompilerResponse); - while (analysis.Id.Equals(EmptyGuid)) + sentRequests.Add(repositoryCompilerResponse.Id); + recivedRequests.Add(analysis.Id); + + while (analysis.Id.Equals(EmptyGuid) || !(repositoryCompilerResponse.Id.Equals(analysis.Id))) { // TODO: Check edge case when we do not have a issue and content for developer analysis = await SendRequestToSmartTutor(repositoryCompilerResponse); - } + } + + System.Diagnostics.Debug.WriteLine(sentRequests); + + System.Diagnostics.Debug.WriteLine("POSLATEEEEEEEEEE"); + int counter = 0; + foreach (Guid guid in sentRequests){ + counter++; + System.Diagnostics.Debug.WriteLine(counter); + System.Diagnostics.Debug.WriteLine(guid); + } + System.Diagnostics.Debug.WriteLine("PRIMLJENEEEEEEE"); + counter = 0; + foreach (Guid guid in recivedRequests) + { + counter++; + System.Diagnostics.Debug.WriteLine(counter); + System.Diagnostics.Debug.WriteLine(guid); + } + return analysis; } diff --git a/Clean CaDET/View/Commands/ExamineProjectItemCommand.cs b/Clean CaDET/View/Commands/ExamineProjectItemCommand.cs index 30a1c28..f4e2cea 100644 --- a/Clean CaDET/View/Commands/ExamineProjectItemCommand.cs +++ b/Clean CaDET/View/Commands/ExamineProjectItemCommand.cs @@ -128,19 +128,22 @@ public static async Task InitializeAsync(AsyncPackage package) } private async void Execute(object sender, EventArgs e) { - ClassQualityAnalysisResponse codeQualityAnalysis = await _service.AnalyzeClassQualityAsync(_selectedFilePath); - - ToolWindowPane window = _package.FindToolWindow(typeof(TutoringWindow), 0, true); - if (window?.Frame == null) + for (int i = 0; i < 50; i++) { - throw new NotSupportedException("Cannot create tool window"); - } + ClassQualityAnalysisResponse codeQualityAnalysis = await _service.AnalyzeClassQualityAsync(_selectedFilePath); + + ToolWindowPane window = _package.FindToolWindow(typeof(TutoringWindow), 0, true); + if (window?.Frame == null) + { + throw new NotSupportedException("Cannot create tool window"); + } - var tutoringWindow = window as TutoringWindow; - tutoringWindow?.UpdateVMContent(codeQualityAnalysis.NewContent); + var tutoringWindow = window as TutoringWindow; + tutoringWindow?.UpdateVMContent(codeQualityAnalysis.NewContent); - IVsWindowFrame windowFrame = (IVsWindowFrame)window.Frame; - ErrorHandler.ThrowOnFailure(windowFrame.Show()); + IVsWindowFrame windowFrame = (IVsWindowFrame)window.Frame; + ErrorHandler.ThrowOnFailure(windowFrame.Show()); + } } } } From 764c6935192324fbc748f733450e161a287a2e55 Mon Sep 17 00:00:00 2001 From: Pufke Date: Sun, 4 Apr 2021 02:21:42 +0200 Subject: [PATCH 14/14] refactor: Get class quality analysis method --- .../PlatformConnection/CaDETConnection.cs | 34 ++++++++----------- .../Commands/ExamineProjectItemCommand.cs | 7 ++-- 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/Clean CaDET/Model/PlatformConnection/CaDETConnection.cs b/Clean CaDET/Model/PlatformConnection/CaDETConnection.cs index c242950..e217ccf 100644 --- a/Clean CaDET/Model/PlatformConnection/CaDETConnection.cs +++ b/Clean CaDET/Model/PlatformConnection/CaDETConnection.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Net.Http; using System.Text; using System.Threading.Tasks; @@ -27,35 +28,30 @@ public async Task GetClassQualityAnalysisAsync(str ClassQualityAnalysisResponse repositoryCompilerResponse = JsonConvert.DeserializeObject(contentRepositoryCompiler); - var bytes = new Byte[16]; - var EmptyGuid = new Guid(bytes); + ClassQualityAnalysisResponse analysis = await SendRequestToSmartTutor(repositoryCompilerResponse); - sentRequests.Add(repositoryCompilerResponse.Id); - recivedRequests.Add(analysis.Id); + var EmptyGuid = new Guid(new Byte[16]); + Guid sentRequest = repositoryCompilerResponse.Id; + Guid recivedRequest = analysis.Id; - while (analysis.Id.Equals(EmptyGuid) || !(repositoryCompilerResponse.Id.Equals(analysis.Id))) - { // TODO: Check edge case when we do not have a issue and content for developer + sentRequests.Add(sentRequest); + recivedRequests.Add(recivedRequest); + + while (recivedRequest.Equals(EmptyGuid) || !(sentRequest.Equals(recivedRequest))) + { analysis = await SendRequestToSmartTutor(repositoryCompilerResponse); } - System.Diagnostics.Debug.WriteLine(sentRequests); - System.Diagnostics.Debug.WriteLine("POSLATEEEEEEEEEE"); - int counter = 0; - foreach (Guid guid in sentRequests){ - counter++; - System.Diagnostics.Debug.WriteLine(counter); - System.Diagnostics.Debug.WriteLine(guid); + if (sentRequests.All(recivedRequests.Contains) && sentRequests.Count == recivedRequests.Count) + { + System.Diagnostics.Debug.WriteLine("All sent messages have arrived"); } - System.Diagnostics.Debug.WriteLine("PRIMLJENEEEEEEE"); - counter = 0; - foreach (Guid guid in recivedRequests) + else { - counter++; - System.Diagnostics.Debug.WriteLine(counter); - System.Diagnostics.Debug.WriteLine(guid); + System.Diagnostics.Debug.WriteLine("Not all sent messages have arrived"); } return analysis; diff --git a/Clean CaDET/View/Commands/ExamineProjectItemCommand.cs b/Clean CaDET/View/Commands/ExamineProjectItemCommand.cs index f4e2cea..3bcc678 100644 --- a/Clean CaDET/View/Commands/ExamineProjectItemCommand.cs +++ b/Clean CaDET/View/Commands/ExamineProjectItemCommand.cs @@ -128,8 +128,9 @@ public static async Task InitializeAsync(AsyncPackage package) } private async void Execute(object sender, EventArgs e) { - for (int i = 0; i < 50; i++) - { + /* Uncomment this for loop if you want to test sending more than one request*/ +/* for (int i = 0; i < 100; i++) + {*/ ClassQualityAnalysisResponse codeQualityAnalysis = await _service.AnalyzeClassQualityAsync(_selectedFilePath); ToolWindowPane window = _package.FindToolWindow(typeof(TutoringWindow), 0, true); @@ -143,7 +144,7 @@ private async void Execute(object sender, EventArgs e) IVsWindowFrame windowFrame = (IVsWindowFrame)window.Frame; ErrorHandler.ThrowOnFailure(windowFrame.Show()); - } +/* }*/ } } }