Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] displaying marks when placing them #274

Merged
merged 1 commit into from
Oct 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public class SaveSingleStudentMarkPageViewModel : ViewModel
public List<VisitingPageModel> _currentLabsVisitingMarksSubGroup1;
public List<VisitingPageModel> _currentLabsVisitingMarksSubGroup2;
public List<string> FullNames { get; set; }
public List<string> NameOfLabOrPr { get; set; }
public TakedLabs _takedLabs { get; set; }
public string _title { get; set; }
public string studentName { get; set; }
Expand All @@ -33,7 +34,7 @@ public class SaveSingleStudentMarkPageViewModel : ViewModel
public LabsVisitingList fullPractice = new LabsVisitingList();

public SaveSingleStudentMarkPageViewModel(IPlatformServices services,
string nameofLabOrPr, LabsVisitingList marks, TakedLabs prOrLabStat, string title, string _studName, int subGruop)
List<string> nameofLabOrPr, LabsVisitingList marks, TakedLabs prOrLabStat, string title, string _studName, int subGruop)
{
_subGruop = subGruop;
studentName = _studName;
Expand All @@ -48,7 +49,8 @@ public SaveSingleStudentMarkPageViewModel(IPlatformServices services,
}
_services = services;
_takedLabs = prOrLabStat;
SelectedShortName = nameofLabOrPr;
SelectedShortName = nameofLabOrPr[0];
NameOfLabOrPr = nameofLabOrPr;
}

Command _saveMarksButton;
Expand All @@ -61,6 +63,24 @@ public Command SaveMarksButton
}
}

public void setMarks(object selectedLab)
{
foreach (var student in fullMarksLabs.Students)
{
if (student.FullName == studentName)
{
for (int i = 0; i < NameOfLabOrPr.Count; i++)
{
if (NameOfLabOrPr[i] == selectedLab.ToString())
{
MarkStudent = Convert.ToInt32(student.LabsMarks[i].Mark);
return;
}
}
}
}
}

private async Task saveMarks()
{
string body = "";
Expand Down Expand Up @@ -138,6 +158,13 @@ public int Mark
set { SetProperty(ref _mark, value); }
}

int _markStudent;
public int MarkStudent
{
get { return _markStudent; }
set { SetProperty(ref _markStudent, value); }
}

string _comment;
public string Comment
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using EduCATS.Helpers.Forms;
 using EduCATS.Helpers.Forms;
using EduCATS.Helpers.Forms.Styles;
using EduCATS.Networking.Models.SaveMarks;
using EduCATS.Networking.Models.SaveMarks.LabSchedule;
Expand All @@ -20,6 +20,7 @@ public class SaveSingleStudentMarkPageView : ContentPage
const double _heightRequest = 40;

static Thickness _padding = new Thickness(10, 1);
static Thickness _studentNameMargin = new Thickness(1, 5);
public List<int> Marks = new List<int> { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
public List<string> NameOfLabOrPractice = new List<string>();
public string _title { get; set; }
Expand All @@ -35,7 +36,7 @@ public SaveSingleStudentMarkPageView(string title, string name, LabsVisitingList
NameOfLabOrPractice.Add(pract.ShortName);
}
BindingContext = new SaveSingleStudentMarkPageViewModel(new PlatformServices(),
NameOfLabOrPractice.FirstOrDefault(), marks, prOrLabStat, title, name, subGruop);
NameOfLabOrPractice, marks, prOrLabStat, title, name, subGruop);
}
else if (title == CrossLocalization.Translate("stats_page_labs_rating"))
{
Expand All @@ -47,19 +48,19 @@ public SaveSingleStudentMarkPageView(string title, string name, LabsVisitingList
}
}
BindingContext = new SaveSingleStudentMarkPageViewModel(new PlatformServices(),
NameOfLabOrPractice.FirstOrDefault(), marks, prOrLabStat, title, name, subGruop);
NameOfLabOrPractice, marks, prOrLabStat, title, name, subGruop);
}
BackgroundColor = Color.FromHex(Theme.Current.AppBackgroundColor);
Padding = _padding;
NavigationPage.SetHasNavigationBar(this, false);
var entryStyle = getEntryStyle();
var inicials = new Label
{
VerticalOptions = LayoutOptions.CenterAndExpand,
Margin = _studentNameMargin,
TextColor = Color.FromHex(Theme.Current.StatisticsDetailsNameColor),
HorizontalOptions = LayoutOptions.CenterAndExpand,
TextColor = Color.FromHex(Theme.Current.StatisticsDetailsTitleColor),
Style = AppStyles.GetLabelStyle(),
Font = Font.SystemFontOfSize(NamedSize.Large).WithSize(20).WithAttributes(FontAttributes.Bold),
HorizontalTextAlignment = TextAlignment.Center,
Style = AppStyles.GetLabelStyle(NamedSize.Large),
Text = name,
};

Expand Down Expand Up @@ -122,7 +123,15 @@ public SaveSingleStudentMarkPageView(string title, string name, LabsVisitingList
HorizontalTextAlignment = TextAlignment.Center,
};

markPicker.SetBinding(Picker.SelectedItemProperty, "Mark");
markPicker.SetBinding(Picker.SelectedItemProperty, "MarkStudent");

nameOfPrOrLb.SelectedIndexChanged += (sender, e) =>
{
var selectedLab = nameOfPrOrLb.SelectedItem;
var vm = BindingContext as SaveSingleStudentMarkPageViewModel;
vm.setMarks(selectedLab);
markPicker.SetBinding(Picker.SelectedItemProperty, "MarkStudent");
};

var datePicker = new Entry
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class ProfilePageView : ContentPage
static Thickness _listMarginLabel = new Thickness(20, 0, 0, 0);
static Thickness _listMarginBlock = new Thickness(0, 3, 0, 3);

const double _spacing = 20;
const double _spacing = 25;
const double _spacingLabel = 0;
const double _buttonHeight = 50;
const double _avatarHeight = 200;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class VisitingPageViewCell : ViewCell

const double _controlHeight = 50;

public List<string> listOfMarks = new List<string> { "1", "2", "3", "4" };
public List<string> listOfMarks = new List<string> { "", "1", "2", "3", "4" };

public BindableProperty HeightRequestProperty { get; private set; }
public BindableProperty BackgroundColorProperty { get; private set; }
Expand All @@ -26,7 +26,7 @@ public VisitingPageViewCell()
{
VerticalOptions = LayoutOptions.CenterAndExpand,
TextColor = Color.FromHex(Theme.Current.StatisticsDetailsTitleColor),
//Font = Font.SystemFontOfSize(NamedSize.Large).WithAttributes(FontAttributes.Bold),
Font = Font.SystemFontOfSize(NamedSize.Large).WithSize(20),
Style = AppStyles.GetLabelStyle()
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ namespace EduCATS.Pages.Statistics.Results.Views
{
public class StatsResultsPageView : ContentPage
{
static Thickness _padding = new Thickness(10, 1);
static Thickness _studentNameMargin = new Thickness(1, 5);
static Thickness _padding = new Thickness(10, 1);
static Thickness _studentNameMargin = new Thickness(1, 5, 0, 5);

readonly StatsPageEnum _statsPageEnum;

Expand Down
Loading