<commit_before>'use strict';

angular.module('<%=angularAppName%>')
    .factory('<%= entityClass %>', function ($resource) {
        return $resource('api/<%= entityInstance %>s/:id', {}, {
            'query': { method: 'GET', isArray: true},
            'get': {
                method: 'GET',
                transformResponse: function (data) {
                    data = angular.fromJson(data);<% for (fieldId in fields) { if (fields[fieldId].fieldType == 'LocalDate') { %>
                    if (data.<%=fields[fieldId].fieldName%> != null){
                        var <%=fields[fieldId].fieldName%>From = data.<%=fields[fieldId].fieldName%>.split("-");
                        data.<%=fields[fieldId].fieldName%> = new Date(new Date(<%=fields[fieldId].fieldName%>From[0], <%=fields[fieldId].fieldName%>From[1] - 1, <%=fields[fieldId].fieldName%>From[2]));
                    }<% }if (fields[fieldId].fieldType == 'DateTime') { %>
                    if (data.<%=fields[fieldId].fieldName%> != null) data.<%=fields[fieldId].fieldName%> = new Date(data.<%=fields[fieldId].fieldName%>);<% } }%>
                    return data;
                }
            },
            'update': { method:'PUT' }
        });
    });<commit_msg>Fix Timezone issues on LocalDate<commit_after>'use strict';

angular.module('<%=angularAppName%>')
    .factory('<%= entityClass %>', function ($resource) {
        return $resource('api/<%= entityInstance %>s/:id', {}, {
            'query': { method: 'GET', isArray: true},
            'get': {
                method: 'GET',
                transformResponse: function (data) {
                    data = angular.fromJson(data);<% for (fieldId in fields) { if (fields[fieldId].fieldType == 'LocalDate') { %>
                    if (data.<%=fields[fieldId].fieldName%> != null){
                        var <%=fields[fieldId].fieldName%>From = data.<%=fields[fieldId].fieldName%>.split("-");
                        data.<%=fields[fieldId].fieldName%> = new Date(new Date(<%=fields[fieldId].fieldName%>From[0], <%=fields[fieldId].fieldName%>From[1] - 1, <%=fields[fieldId].fieldName%>From[2]));
                    }<% }if (fields[fieldId].fieldType == 'DateTime') { %>
                    if (data.<%=fields[fieldId].fieldName%> != null) data.<%=fields[fieldId].fieldName%> = new Date(data.<%=fields[fieldId].fieldName%>);<% } }%>
                    return data;
                }
            },<% if (fieldsContainLocalDate == true) { %>
            'update': {
                method: 'PUT',
                transformRequest: function (data) {<% for (fieldId in fields) { if (fields[fieldId].fieldType == 'LocalDate') { %>
                    var <%=fields[fieldId].fieldName%> = new Date();
                    <%=fields[fieldId].fieldName%>.setUTCDate(data.<%=fields[fieldId].fieldName%>.getDate());
                    <%=fields[fieldId].fieldName%>.setUTCMonth(data.<%=fields[fieldId].fieldName%>.getMonth());
                    <%=fields[fieldId].fieldName%>.setUTCFullYear(data.<%=fields[fieldId].fieldName%>.getFullYear());
                    data.<%=fields[fieldId].fieldName%> = <%=fields[fieldId].fieldName%>;<% } }%>
                    return angular.toJson(data);
                }
            },
            'save': {
                method: 'POST',
                transformRequest: function (data) {<% for (fieldId in fields) { if (fields[fieldId].fieldType == 'LocalDate') { %>
                    var <%=fields[fieldId].fieldName%> = new Date();
                    <%=fields[fieldId].fieldName%>.setUTCDate(data.<%=fields[fieldId].fieldName%>.getDate());
                    <%=fields[fieldId].fieldName%>.setUTCMonth(data.<%=fields[fieldId].fieldName%>.getMonth());
                    <%=fields[fieldId].fieldName%>.setUTCFullYear(data.<%=fields[fieldId].fieldName%>.getFullYear());
                    data.<%=fields[fieldId].fieldName%> = <%=fields[fieldId].fieldName%>;<% } }%>
                    return angular.toJson(data);
                }
            }<% } else { %>
            'update': { method:'PUT' }<% } %>
        });
    });
{'fraction_non_alphanumeric': 0.19883183256266732, 'fraction_numerical': 0.0019469457288878072, 'mean_word_length': 2.2184808144087707, 'pattern_counts': {'":': 0, '<': 60, '<?xml version=': 0, '>': 60, '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': '2013536', 'n_tokens_mistral': 1266, 'n_tokens_neox': 1155, 'n_words': 170}