<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Diagnostics;
using System.Windows.Markup;
using System.Globalization;
using System.IO;
using System.Collections;
using System.Runtime.Serialization.Formatters.Binary; 

namespace MyApp.Tools
{

    [ValueConversion(typeof(string), typeof(string))]
    public class RatioConverter : MarkupExtension, IValueConverter
    {
        private static RatioConverter _instance;

        public RatioConverter() { }

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        { // do not let the culture default to local to prevent variable outcome re decimal syntax
            double size = System.Convert.ToDouble(value) * System.Convert.ToDouble(parameter, CultureInfo.InvariantCulture);
            return size.ToString("G0", CultureInfo.InvariantCulture);
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        { // read only converter...
            throw new NotImplementedException();
        }

        public override object ProvideValue(IServiceProvider serviceProvider)
        {
            return _instance ?? (_instance = new RatioConverter());
        }

    }
}

namespace Saveyour
{
    /// <summary>
    /// Interaction logic for WeeklyToDo.xaml
    /// </summary>
    /// 

    public partial class WeeklyToDo : Window, Module
    {

        //private List<DateTask> dates = new List<DateTask>();

        private DateTime nextWeek;
        private DateTime yesterday;
        private List<TextBlock> days = new List<TextBlock>();
        private List<StackPanel> taskDays = new List<StackPanel>();
        private DateTime curTopDay;
        private Dictionary<DateTime,List<Task>> hashTasks;
        private Border[] borders;




        public WeeklyToDo()
        {
            InitializeComponent();

            //this.Height = (System.Windows.SystemParameters.PrimaryScreenHeight * 1);
            //this.Width = (System.Windows.SystemParameters.PrimaryScreenWidth * 0.2);

            Left = System.Windows.SystemParameters.PrimaryScreenWidth - Width;
            Top = 0;

            hashTasks = new Dictionary<DateTime,List<Task>>();

            curTopDay = DateTime.Today;

            nextWeek = DateTime.Today.AddDays(7);
            nextWeek = new DateTime(nextWeek.Year, nextWeek.Month, nextWeek.Day);

            yesterday = DateTime.Today.AddDays(-1);
            yesterday = new DateTime(yesterday.Year, yesterday.Month, yesterday.Day);

            TextBlock today = null;
            Border todayBorder = null;
            days.Add(SundayTitle);
            days.Add(MondayTitle);
            days.Add(TuesdayTitle);
            days.Add(WednesdayTitle);
            days.Add(ThursdayTitle);
            days.Add(FridayTitle);
            days.Add(SaturdayTitle);

            taskDays.Add(SundayTasks);
            taskDays.Add(MondayTasks);
            taskDays.Add(TuesdayTasks);
            taskDays.Add(WednesdayTasks);
            taskDays.Add(ThursdayTasks);
            taskDays.Add(FridayTasks);
            taskDays.Add(SaturdayTasks);

            borders = new Border[14];
            borders[0] = SundayTitleBorder;
            borders[1] = SundayTaskBorder;
            borders[2] = MondayTitleBorder;
            borders[3] = MondayTaskBorder;
            borders[4] = TuesdayTitleBorder;
            borders[5] = TuesdayTaskBorder;
            borders[6] = WednesdayTitleBorder;
            borders[7] = WednesdayTaskBorder;
            borders[8] = ThursdayTitleBorder;
            borders[9] = ThursdayTaskBorder;
            borders[10] = FridayTitleBorder;
            borders[11] = FridayTaskBorder;
            borders[12] = SaturdayTitleBorder;
            borders[13] = SaturdayTaskBorder;

            int numToday = (int)DateTime.Today.DayOfWeek;
            today = days[numToday];
            todayBorder = borders[numToday * 2];
            reOrderDays();

            int j = 0;
            foreach (TextBlock day in days)
            {
                    //numToday--;
		         colorByWeights(j);
                   // day.Text += " " + DateTime.Today.AddDays(numToday * -1).ToString("d");

               day.Text = "";
               int count = (j - numToday + 7) % 7;
               day.Text = curTopDay.AddDays(count - numToday).ToString("dddd");
               day.Text += " " + curTopDay.AddDays(count - numToday).ToString("d");
                   j++;
            }
          
            today.Text += " (TODAY)";
            //COLORS ARE SUBJECT TO CHANGE (someone change them if they have a good color scheme!)
            today.Foreground = new SolidColorBrush(Colors.Black); //Changes text color
            //todayborder.background = new solidcolorbrush(Colors.Cyan); //changes background color
        }
	
	/*Recolors the given day of the week (0=Sunday ... 6 = Saturday) based upon the weights of all the tasks in that day. */
	private void colorByWeights(int dayOfWeek){ //Currently only adds in today.
		// Converts the int for the dayOfWeek to the date that it corrsponds to
		DateTime day = curTopDay.AddDays((dayOfWeek + 7 - (int)(curTopDay.DayOfWeek) )%7 );
		int weight = sumOfTaskWeights(day);
		if (weight < 5){
            		//borders[dayOfWeek*2].Background = new SolidColorBrush(Colors.Green); //changes background color of title
            		borders[dayOfWeek*2 + 1].Background = new SolidColorBrush(Colors.Green); //changes background color of tasks list
		}
		else if(weight >=5 && weight < 8){		
            		//borders[dayOfWeek*2].Background = new SolidColorBrush(Colors.Yellow); //changes background color of title
            		borders[dayOfWeek*2 + 1].Background = new SolidColorBrush(Colors.Yellow); //changes background color of tasks list
		}

				
		else if(weight >=8 && weight < 10){		<commit_msg>Fixed an error with the ordering of days in WeeklyToDo on initialization.<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Diagnostics;
using System.Windows.Markup;
using System.Globalization;
using System.IO;
using System.Collections;
using System.Runtime.Serialization.Formatters.Binary; 

namespace MyApp.Tools
{

    [ValueConversion(typeof(string), typeof(string))]
    public class RatioConverter : MarkupExtension, IValueConverter
    {
        private static RatioConverter _instance;

        public RatioConverter() { }

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        { // do not let the culture default to local to prevent variable outcome re decimal syntax
            double size = System.Convert.ToDouble(value) * System.Convert.ToDouble(parameter, CultureInfo.InvariantCulture);
            return size.ToString("G0", CultureInfo.InvariantCulture);
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        { // read only converter...
            throw new NotImplementedException();
        }

        public override object ProvideValue(IServiceProvider serviceProvider)
        {
            return _instance ?? (_instance = new RatioConverter());
        }

    }
}

namespace Saveyour
{
    /// <summary>
    /// Interaction logic for WeeklyToDo.xaml
    /// </summary>
    /// 

    public partial class WeeklyToDo : Window, Module
    {

        //private List<DateTask> dates = new List<DateTask>();

        private DateTime nextWeek;
        private DateTime yesterday;
        private List<TextBlock> days = new List<TextBlock>();
        private List<StackPanel> taskDays = new List<StackPanel>();
        private DateTime curTopDay;
        private Dictionary<DateTime,List<Task>> hashTasks;
        private Border[] borders;




        public WeeklyToDo()
        {
            InitializeComponent();

            //this.Height = (System.Windows.SystemParameters.PrimaryScreenHeight * 1);
            //this.Width = (System.Windows.SystemParameters.PrimaryScreenWidth * 0.2);

            Left = System.Windows.SystemParameters.PrimaryScreenWidth - Width;
            Top = 0;

            hashTasks = new Dictionary<DateTime,List<Task>>();

            curTopDay = DateTime.Today;

            nextWeek = DateTime.Today.AddDays(7);
            nextWeek = new DateTime(nextWeek.Year, nextWeek.Month, nextWeek.Day);

            yesterday = DateTime.Today.AddDays(-1);
            yesterday = new DateTime(yesterday.Year, yesterday.Month, yesterday.Day);

            TextBlock today = null;
            Border todayBorder = null;
            days.Add(SundayTitle);
            days.Add(MondayTitle);
            days.Add(TuesdayTitle);
            days.Add(WednesdayTitle);
            days.Add(ThursdayTitle);
            days.Add(FridayTitle);
            days.Add(SaturdayTitle);

            taskDays.Add(SundayTasks);
            taskDays.Add(MondayTasks);
            taskDays.Add(TuesdayTasks);
            taskDays.Add(WednesdayTasks);
            taskDays.Add(ThursdayTasks);
            taskDays.Add(FridayTasks);
            taskDays.Add(SaturdayTasks);

            borders = new Border[14];
            borders[0] = SundayTitleBorder;
            borders[1] = SundayTaskBorder;
            borders[2] = MondayTitleBorder;
            borders[3] = MondayTaskBorder;
            borders[4] = TuesdayTitleBorder;
            borders[5] = TuesdayTaskBorder;
            borders[6] = WednesdayTitleBorder;
            borders[7] = WednesdayTaskBorder;
            borders[8] = ThursdayTitleBorder;
            borders[9] = ThursdayTaskBorder;
            borders[10] = FridayTitleBorder;
            borders[11] = FridayTaskBorder;
            borders[12] = SaturdayTitleBorder;
            borders[13] = SaturdayTaskBorder;

            int numToday = (int)DateTime.Today.DayOfWeek;

            today = days[numToday];
            todayBorder = borders[numToday * 2];
            reOrderDays();

            int j = 0;
            foreach (TextBlock day in days)
            {
		       colorByWeights(j);
               day.Text = "";
               day.Text = curTopDay.AddDays(j - numToday).ToString("dddd");
               day.Text += " " + curTopDay.AddDays(j - numToday).ToString("d");
               j++;
            }

            reOrderDays();
          
            today.Text += " (TODAY)";
            //COLORS ARE SUBJECT TO CHANGE (someone change them if they have a good color scheme!)
            today.Foreground = new SolidColorBrush(Colors.Black); //Changes text color
            //todayborder.background = new solidcolorbrush(Colors.Cyan); //changes background color
        }
	
	/*Recolors the given day of the week (0=Sunday ... 6 = Saturday) based upon the weights of all the tasks in that day. */
	private void colorByWeights(int dayOfWeek){ //Currently only adds in today.
		// Converts the int for the dayOfWeek to the date that it corrsponds to
		DateTime day = curTopDay.AddDays((dayOfWeek + 7 - (int)(curTopDay.DayOfWeek) )%7 );
		int weight = sumOfTaskWeights(day);
		if (weight < 5){
            		//borders[dayOfWeek*2].Background = new SolidColorBrush(Colors.Green); //changes background color of title
            		borders[dayOfWeek*2 + 1].Background = new SolidColorBrush(Colors.Green); //changes background color of tasks list
		}
		else if(weight >=5 && weight < 8){		
            		//borders[dayOfWeek*2].Background = new SolidColorBrush(Colors.Yellow); //changes background color of title
            		borders[dayOfWeek*2 + 1].Background = new SolidColorBrush(Colors.Yellow); //changes background color of tasks list
		}

				
		else if(weight >=8 && weight < 10){		
{'fraction_non_alphanumeric': 0.10027628798959858, 'fraction_numerical': 0.007557289127254997, 'mean_word_length': 2.3653267705769756, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6183942', 'n_tokens_mistral': 3412, 'n_tokens_neox': 3181, 'n_words': 814}